Are you trying to get first and last names from the User model? That
would be either self.user.first_name and self.user.last_name (within
model) or student.user.first_name and student.user.last_name (outside
of model). Hope that helps a bit.
On May 4, 8:13 pm, Jonathan Lukens <[EMAIL PROTECTED]>
Maybe are wanting to populate that field automatically and you are
looking for a custom save() method? This would do the trick:
...
def save(self):
self.first_name = self.user.first_name
super(Student, self).save()
You will also want to add blank=True or editable=False to the
CharField arg
user.firstname
user.lastname
??
Is that what you are looking for?
mike
chiefmoamba wrote:
> 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_n
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
4 matches
Mail list logo