hi
i have create the a save method, to add the user. but the user cannot
be accessed from the person class. this is the code any suggestion to
correct it:
from django.db import models
import datetime
class Persons (models.Model):
user = models.OneToOneField(Users)
firstName = models.CharField(maxlength=200)
lastName = models.CharField(maxlength=200)
middleName = models.CharField(maxlength=200)
birthdate = models.DateTimeField ('Birth Date')
def __str__(self):
return self.firstName
def save (self):
super (Users, self.user)
class Admin:
list_filter = ['firstName']
search_fields = ['firstName']
date_hierarchy = 'birthdate'
list_display = ('firstName', 'lastName')
fields = (
('Person Information', {'fields':('firstName',
'middleName','lastName', 'birthdate',),}),
)
class Users (models.Model):
persons = models.OneToOneField (Persons,
edit_inline=models.STACKED, num_in_admin=1)
userName = models.CharField(maxlength=10, core = True)
password = models.CharField(maxlength=10)
creationDate = models.DateTimeField(auto_now_add = True)
modifiedDate = models.DateTimeField(auto_now = True)
def __str__(self):
return self.userName
class Admin:
fields = (
('User Information', {'fields':('userName',
'password',),}),
)
The message that results is:
name 'Users' is not defined
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---