Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class CommonAbstractModel(models.Model):
- """
- Common ABC for most models.
- Provides created/updated_at, created/updated_by, and active/inactive status.
- """
- created_at = models.DateTimeField(
- default=datetime.datetime.now(), editable=False)
- updated_at = AutoDateTimeField(editable=False)
- created_by = models.ForeignKey(User, blank=True, editable=False,
- related_name="creates")
- updated_by = models.ForeignKey(User, blank=True, editable=False,
- related_name="updates")
- active = models.BooleanField(default=True)
- class LibraryAbstractModel(models.Model):
- """ generic class for library items """
- title = models.CharField(max_length=255)
- slug = models.SlugField()
- description = models.TextField()
- download = models.BooleanField(default=False)
- share = models.BooleanField(default=False)
- email = models.BooleanField(default=False)
- embed = models.BooleanField(default=False)
- library_set = models.ForeignKey('LibrarySet',
- blank=True, related_name='members')
- keywords = TagField()
- publisher = models.ForeignKey('Publisher',
- blank=True, related_name='publications')
- authors = models.ManyToManyField('Author',
- blank=True, related_name='publications')
- class Audio(CommonAbstractModel, LibraryAbstractModel):
- """ Audio items in the library """
- runtime = models.CharField(max_length=255)
- transcript = models.TextField()
- class LibrarySet(CommonAbstractModel):
- """ Set of materials in the library """
- title = models.CharField(max_length=255)
- slug = models.SlugField()
Add Comment
Please, Sign In to add comment