class Channels(BaseAbstractModel): """This class defines the Categories model""" name = models.CharField(max_length=255) ch_num = models.IntegerField(default=0) category = models.ManyToManyField(Categories, related_name='category') channel_url = models.URLField(max_length=255) EPG_file = models.FileField(blank=True, null=True) channel_image = models.FileField() description = models.TextField() is_popular = models.BooleanField(default=False) catchup_recording_hours = models.IntegerField(default=0) catchup_url = models.URLField(max_length=255, null=True, blank=True) objects = models.Manager() active_objects = ChannelsQuery.as_manager() def __str__(self): return self.name def save(self, *args, **kwargs): """Saves all the changes of the Channels model""" super().save(*args, **kwargs) class Meta: verbose_name_plural = "Channels"
class RadioChannel(BaseAbstractModel): """This class defines the Categories model""" serial_no = models.IntegerField(default=0) name = models.CharField(max_length=255) category = models.ManyToManyField(RadioCategory, related_name='radio_category') channel_url = models.URLField(max_length=255) channel_image = models.FileField() EPG_file = models.FileField(blank=True, null=True) description = models.TextField() is_popular = models.BooleanField(default=False) objects = models.Manager() active_objects = ChannelsQuery.as_manager() def __str__(self): return self.name def save(self, *args, **kwargs): """Saves all the changes of the Channels model""" super().save(*args, **kwargs) class Meta: verbose_name_plural = "Radio Channels" app_label = "radio"
class Archives(BaseAbstractModel): """This class defines the Categories model""" VIDEO_TYPE = (('VD', 'video_on_demand'), ('AR', 'archive')) name = models.CharField(max_length=255) channel = models.ForeignKey(Channels, on_delete=models.CASCADE) video_url = models.URLField(max_length=255) # video_type = models.CharField( # verbose_name='video type', max_length=20, choices=VIDEO_TYPE # ) owner = models.ForeignKey(User, on_delete=models.CASCADE) objects = models.Manager() active_objects = ChannelsQuery.as_manager() def __str__(self): return self.name def save(self, *args, **kwargs): """Saves all the changes of the Archive model""" super().save(*args, **kwargs) class Meta: verbose_name_plural = "Archieves"
class Categories(BaseAbstractModel): """This class defines the Categories model""" name = models.CharField(max_length=255) background_image = models.FileField(blank=True, null=True) is_adult = models.BooleanField(default=False) is_published = models.BooleanField(default=False) objects = models.Manager() active_objects = ChannelsQuery.as_manager() def __str__(self): return self.name def save(self, *args, **kwargs): """Saves all the changes of the Categories model""" super().save(*args, **kwargs) class Meta: verbose_name_plural = "Categories"
class Content(BaseAbstractModel): """This class defines the Content model""" name = models.CharField(max_length=255) category = models.ManyToManyField( Category, related_name='category') content_url = models.URLField(max_length=255) content_image = models.FileField(blank=True, null=True) is_popular = models.BooleanField(default=False) objects = models.Manager() active_objects = ChannelsQuery.as_manager() def __str__(self): return self.name def save(self, *args, **kwargs): """Saves all the changes of the Channels model""" super().save(*args, **kwargs) class Meta: verbose_name_plural = "Contents"