On Thu, Jul 3, 2008 at 8:59 PM, lukeqsee <[EMAIL PROTECTED]> wrote:
>
> Can you take a first_name & a last_name field and then in the same
> model make a field that is full_name? ie
> first_name = models.CharField(max_length=75)
> last_name = models.CharField(max_length=75)
> full_name = models.CharField(value=first_name + last_name,
> max_length=100)

Not like this, no, but you seem to be hung up on trying to use field
classes for everything. This is not necessary (and in this case would
be a bad idea: you'd have duplicated data and you'd need to constantly
watch out to prevent the fields getting out of sync with each other),
because you can define perfectly normal Python attributes and methods
on your models.

Most likely you want to use a property with both a getter and a
setter, as shown in the examples in the documentation:

http://www.djangoproject.com/documentation/models/properties/



-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to