Hallo, How could I implement forward declaration in django models? this example wouldn't work for me: Has anyone an idear or a solution?
This django model show a simple implementation for a bloodline app! ******************************************************************************** from django.db import models from django.contrib.auth.models import User from django.contrib import admin class Parent: pass class Child: pass class AbstractUser(models.Model): user_id = models.ForeignKey(User, blank=True) birthday = models.DateField("birthday", blank=True, null=True) day_of_death = models.DateField("day of death", blank=True, null=True) parents = models.ManyToManyField(Parent, blank=True, null=True) childs = models.ManyToManyField(Child, blank=True, null=True) class Parent(AbstractUser): #user_id = models.ForeignKey(User, blank=True) def __unicode__(self): return "%s %s" % (self.user_id.first_name, self.user_id.last_name) class Child(AbstractUser): #user_id = models.ForeignKey(User, blank=True) def __unicode__(self): return "%s %s" % (self.user_id.first_name, self.user_id.last_name) class MyUser(AbstractUser): """ Represent a User for this site """ def __unicode__(self): return "%s %s" % (self.user_id.first_name, self.user_id.last_name) admin.site.register(MyUser) admin.site.register(Parent) admin.site.register(Child) ******************************************************************************** I got this error message: AssertionError: ManyToManyField(<class stammbaum.bloodline.models.Parent at 0x84fc11c>) is invalid. First parameter to ManyToManyField must be either a model, a model name, or the string 'self' regards R.Klain --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---