Don't allow duplicate records for the same CAS number.
authorW. Trevor King <wking@drexel.edu>
Mon, 2 Apr 2012 14:39:57 +0000 (10:39 -0400)
committerW. Trevor King <wking@drexel.edu>
Mon, 2 Apr 2012 14:39:57 +0000 (10:39 -0400)
chemdb/models.py

index 5ef57d1cd95abf123e627f4500dc965ba0c50e62..02c1e548805f178ee479a066111bbe1028e7c7b2 100644 (file)
@@ -33,7 +33,7 @@ class NFPASpecial (NamedItem):
 class CASNumber (NamedItem):
     "Chemical Abstracts Service registery number"
     cas = _models.CharField(
-        'CAS#', max_length=20)
+        'CAS#', max_length=20, unique=True)
 
     def clean(self):
         if not _util.valid_CASno(self.cas):