What I want is to "automatic" add an owner to every object..

Is there another way to accomplish the same?


Fredrik


On Apr 3, 10:48 pm, Thierry Chich <thierry.ch...@gmail.com> wrote:
> I think that if you want make inheritance it is because you want to  
> have others subclasses. But then, your related name will be same for  
> all the subclasses.
> There is no solution with the stable version. In the dev version, it  
> is possible to add the origin class name in the related_name. It is  
> documented, but i don't remember where exactly.
>
> Thierry
>
> Le 3 avr. 2010 à 20:38, Fredrik <frecarl...@gmail.com> a écrit :
>
> > Hi,
> > I want to use it like this:
>
> > """
> > class PersistentModel(models.Model):
> >    deleted = models.BooleanField(default = False)
> >    date_created = models.DateTimeField(default=datetime.now)
> >    date_edited = models.DateTimeField(default=datetime.now)
> >    owner = models.ForeignKey(User)
>
> > class Contacts(PersistentModel):
> >        full_name = models.CharField("Fullt navn", max_length=20)
> >        address = models.CharField("Adresse", max_length=50)
> >        phone = models.CharField("Telefon", max_length=20)
> >        email = models.EmailField("Epost", max_length=50)
>
> >        def __unicode__ (self):
> >            return self.full_name
> > """
>
> > But it creates errors,
> > " Reverse query name for field 'owner' clashes with field
> > 'User.email'. Add a related_name argument to the definition for
> > 'owner'.
>
> > But if I try to add related_name to owner, then I get a lot of errors
> > like this:
>
> > """
> > contacts.contacts: Accessor for field 'owner' clashes with related
> > field 'User.Owner'. Add a related_name argument to the definition for
> > 'owner'.
> > contacts.contacts: Reverse query name for field 'owner' clashes with
> > related field 'User.Owner'. Add a related_name argument to the
> > definition for 'owner'.
> > contacts.contacts: Accessor for field 'owner' clashes with related
> > field 'User.Owner'. Add a related_name argument to the definition for
> > 'owner'.
> > contacts.contacts: Reverse query name for field 'owner' clashes with
> > related field 'User.Owner'. Add a related_name argument to the
> > definition for 'owner'.
> > contacts.contacts: Accessor for field 'owner' clashes with related
> > field 'User.Owner'. Add a related_name argument to the definition for
> > 'owner'.
> > contacts.contacts: Reverse query name for field 'owner' clashes with
> > related field 'User.Owner'. Add a related_name argument to the
> > definition for 'owner'.
> > contacts.contacts: Accessor for field 'owner' clashes with related
> > field 'User.Owner'. Add a related_name argument to the definition for
> > 'owner'.
> > """
>
> > Hopefully, someone can help me out :)
>
> > --
> > You received this message because you are subscribed to the Google  
> > Groups "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en
> > .

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

Reply via email to