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)


class Relation(models.Model):
        person = models.ForeignKey(Profile)
        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 [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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to