Hi,

I am having a problem getting data from the user model in to my model
(below).  I can get the usernames easy enough using "user =
models.ForeignKey(User)", but how then do I get the first_name &
last_name in to my model from the user model?

Any ideas appreciated,

Thanks,

Ed


class Student(models.Model):
    user = models.ForeignKey(User)
    first_name = models.CharField(maxlength=40)
    age = models.IntegerField()
    location = models.CharField(maxlength=40)

    def __str__(self):
        return self.first_name

    class Admin:
        list_display = ('user', 'age', 'location',)
        list_filter = ('user', 'location',)
        ordering = ('-user',)
        search_fields = ('user',)
--~--~---------~--~----~------------~-------~--~----~
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