From 8c6104e8bca567f0b61861d968f746ed4b466e92 Mon Sep 17 00:00:00 2001 From: Yohan Boniface <yb@enix.org> Date: Sun, 28 Oct 2012 16:38:05 +0100 Subject: [PATCH] [mod] Do not make Representative an abstract model for now It's not possible to have a ForeignKey pointing on an abstract model, so we have two options to keep Representative: keep in asbtract, and make mandatory to define one and just one class that inherit from it ; have it non abstract, and so having the possibilty to create serveral classes that inherit from Representative, but so it means that all requests will have a JOIN between the two tables --- representatives/models.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/representatives/models.py b/representatives/models.py index 3c79549..37ebfc2 100644 --- a/representatives/models.py +++ b/representatives/models.py @@ -31,12 +31,9 @@ class Representative(models.Model): birth_date = models.DateField(blank=True, null=True) cv = models.TextField(blank=True, null=True) - class Meta: - abstract = True - class Contact(models.Model): - representative = models.ForeignKey("Representative") + representative = models.ForeignKey(Representative) class Meta: abstract = True @@ -92,4 +89,4 @@ class Mandate(models.Model): # Sometimes begin_date and end_date are not available active = models.NullBooleanField(default=False) - representative = models.ForeignKey("Representative") + representative = models.ForeignKey(Representative) -- GitLab