[Django]-Forward declaration – no admin page in django?

12👍

See: http://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey, which says:

If you need to create a relationship on a model that has not
yet been defined, you can use the name of the model, rather
than the model object itself:

 class Car(models.Model):
      manufacturer = models.ForeignKey('Manufacturer')
      # ...

 class Manufacturer(models.Model):
      # ...
👤thedz

Leave a comment