From 2ddfebaf20986def2094736a4579c20487d01cec Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 2 Apr 2012 11:56:19 -0400 Subject: [PATCH] Add related_names to ManyToManyFields for eventual backreferencing. --- chemdb/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chemdb/models.py b/chemdb/models.py index 02c1e54..9aa4e9c 100644 --- a/chemdb/models.py +++ b/chemdb/models.py @@ -47,7 +47,8 @@ class Chemical (NamedItem): duplicate information (e.g. you can have two bottles of acetic acid). """ - cas = _models.ManyToManyField(CASNumber, blank=True, null=True) + cas = _models.ManyToManyField( + CASNumber, blank=True, null=True, related_name='chemicals') msds = _models.FileField( 'Material safety data sheet', upload_to=_util.chemical_upload_to, blank=True, null=True) @@ -57,7 +58,8 @@ class Chemical (NamedItem): 'NFPA fire rating', blank=True, null=True) reactivity = _models.PositiveIntegerField( 'NFPA reactivity rating', blank=True, null=True) - special = _models.ManyToManyField(NFPASpecial, blank=True, null=True) + special = _models.ManyToManyField( + NFPASpecial, blank=True, null=True, related_name='chemicals') mutagen = _models.NullBooleanField() carcinogen = _models.NullBooleanField() teratogen = _models.NullBooleanField() -- 2.26.2