Friday, April 22, 2011

Re: How to register EmployeeAdmin using atributes in Person class

On Fri, Apr 22, 2011 at 11:55 PM, Guevara <eguevara2012@gmail.com> wrote:
> [...]
>
> class Person(models.Model):
>    name = models.CharField(max_length=50)
>    date_inclusion = models.DateField()
>
> class Employee(models.Model):
>    person = models.OneToOneField(Pessoa)
>
> I reed this doc http://docs.djangoproject.com/en/dev/ref/contrib/admin/
> but could not find this information.

Try with

class Employee(Person):
   person = models.OneToOneField(Person, parent_link=True)

or simply with

class Employee(Person):
pass

It you don't want/need control of the name of the 1to1 relationship
between Employee and Person.

Also, see

http://docs.djangoproject.com/en/dev/ref/models/fields/#onetoonefield
http://docs.djangoproject.com/en/dev/topics/db/models/#multi-table-inheritance
http://docs.djangoproject.com/en/dev/topics/db/models/#specifying-the-parent-link-field

--
Ramiro Morales

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate