3 from django
.db
import models
5 from mygpo
.podcasts
.models
import Podcast
6 from mygpo
.core
.models
import UpdateInfoModel
, OrderedModel
9 class ExamplePodcastsManager(models
.Manager
):
10 """ Manager fo the ExamplePodcast model """
12 def get_podcasts(self
):
13 """ The example podcasts """
14 return Podcast
.objects
.filter(examplepodcast__isnull
=False)\
15 .order_by('examplepodcast__order')
18 class ExamplePodcast(UpdateInfoModel
, OrderedModel
):
19 """ Example podcasts returned by the API """
21 podcast
= models
.ForeignKey(Podcast
, on_delete
=models
.CASCADE
)
23 objects
= ExamplePodcastsManager()
25 class Meta(OrderedModel
.Meta
):