added Identifier model

pull/1/head
eric 2012-01-02 17:22:25 -05:00
parent 8e383ce229
commit e1cc56a163
1 changed files with 11 additions and 0 deletions

View File

@ -206,6 +206,17 @@ class Campaign(models.Model):
if premiums.count() == 0:
premiums = Premium.objects.filter(campaign__isnull=True)
return premiums
class Identifier(models.Model):
# olib, ltwk, goog, gdrd, thng, isbn, oclc
type = models.CharField(max_length=4, null=False)
value = models.CharField(max_length=31, null=False)
work = models.ForeignKey("Work", related_name="identifiers", null=False)
edition = models.ForeignKey("Edition", related_name="identifiers", null=True)
class Meta:
unique_together = ("type", "value")
class Work(models.Model):
created = models.DateTimeField(auto_now_add=True)