From 68a42b90ced9badcd873c3240d061e5aab87b8c3 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Thu, 3 Feb 2022 16:17:33 -0500 Subject: [PATCH] "Fix" foreign key to members table Turning off the constraint here is probably not a good idea in the long term, but it will work until I move tables around to make this sane --- membershipworks/routers.py | 3 --- paperwork/models.py | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/membershipworks/routers.py b/membershipworks/routers.py index d1a80b2..906607d 100644 --- a/membershipworks/routers.py +++ b/membershipworks/routers.py @@ -12,9 +12,6 @@ class MembershipWorksRouter: return self.db return None - def allow_relation(self, obj1, obj2, **hints): - return None - def allow_migrate(self, db, app_label, model_name=None, **hints): if db == self.db: return False diff --git a/paperwork/models.py b/paperwork/models.py index 8711282..60add71 100644 --- a/paperwork/models.py +++ b/paperwork/models.py @@ -39,8 +39,7 @@ class Certification(models.Model): number = models.AutoField(db_column='Number', primary_key=True) certification = models.ForeignKey(CertificationDefinition, on_delete=models.PROTECT, db_column='Certification') name = models.CharField(db_column='Name', max_length=255) - # TODO: this should be a fk to the membershipworks.members table - member = models.ForeignKey(Member, on_delete=models.PROTECT, to_field='uid', db_column='uid', blank=True, null=True) + member = models.ForeignKey(Member, on_delete=models.PROTECT, to_field='uid', db_column='uid', blank=True, null=True, db_constraint=False) certified_by = models.CharField(db_column='Certified_By', max_length=255, blank=True, null=True) date = models.DateField(db_column='Date', blank=True, null=True) version = models.CharField(db_column='Version', max_length=255, blank=True, null=True)