It works!! Thanks

On Aug 11, 7:44 pm, Mike Dewhirst <mi...@dewhirst.com.au> wrote:
> sniperwrote:
> > Hi,
> > I am new to django and wanted to try it out.
>
> > I would like to create a table for family tree
> > where Relation is a many to many table which contains Profile ids
>
> > profile_id, relative_id,type,priority.
>
> > RELATIVE_CHOICES = (
> >         (u'F', u'Father'),
> >         (u'M', u'Mother'),
> >         (u'B', u'Brother'),
> >         (u'S', u'Sister'),
> >         (u'N', u'Son'),
> >         (u'D', u'Daugter'),
> >         (u'H', u'Husband'),
> >         (u'W', u'Wife'),
> >     )
>
> > # Create your models here.
> > class Profile(models.Model):
> >    first_name = models.CharField(max_length=20)
> >    last_name = models.CharField(max_length=20,null=True)
> >    gender = models.CharField(max_length=2, choices=GENDER_CHOICES)
> >    birth_date = models.DateTimeField('birth day',null=True)
> >    notes = models.TextField(null=True)
>
> Sniper
>
> I did exactly the same thing at exactly the same stage of my own
> exposure to Django. It gets easier as the newness wears off a bit and
> you get to trust the error messages.
>
> Good luck
>
> > class Relation(models.Model):
>
>      person = models.ForeignKey(Profile, related_name='person_set')
>
> >    person = models.ForeignKey(Profile)
>
>      relative = models.ForeignKey(Profile, related_name='relation_set')
>
>
>
> >    relative = models.ForeignKey(Profile)
> >    type=models.CharField(max_length=2, choices=RELATIVE_CHOICES)
> >    priority = models.IntegerField(default=1)
>
> > how do i do that?
> > right now i am getting this error
>
> > Error: One or more models did not validate:
> > ftree.relation: Accessor for field 'person' clashes with related field
> > 'Profile.relation_set'. Add a
> >  related_name argument to the definition for 'person'.
> > ftree.relation: Accessor for field 'relative' clashes with related
> > field 'Profile.relation_set'. Add
> >  a related_name argument to the definition for 'relative'.
>
> > thanks
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to