1 from django
.db
import models
3 from mygpo
.podcasts
.models
import Podcast
4 from mygpo
.core
.models
import UpdateInfoModel
, OrderedModel
7 class ExamplePodcastsManager(models
.Manager
):
8 """Manager fo the ExamplePodcast model"""
10 def get_podcasts(self
):
11 """The example podcasts"""
12 return Podcast
.objects
.filter(examplepodcast__isnull
=False).order_by(
13 "examplepodcast__order"
17 class ExamplePodcast(UpdateInfoModel
, OrderedModel
):
18 """Example podcasts returned by the API"""
20 podcast
= models
.ForeignKey(Podcast
, on_delete
=models
.CASCADE
)
22 objects
= ExamplePodcastsManager()
24 class Meta(OrderedModel
.Meta
):
25 unique_together
= [("order",)]