[Tests] track coverage of templates
[mygpo.git] / mygpo / search / json.py
blob7bd2a66eb67112ea5558ac492f35471aa73aeba8
2 """ Converts models to a JSON representation """
5 def podcast_to_json(podcast):
6 """ Convert a podcast to JSON for indexing """
7 doc = {
8 'title': podcast.title,
9 'subtitle': podcast.subtitle,
10 'description': podcast.description,
11 'link': podcast.link,
12 'language': podcast.language,
13 'last_update': podcast.last_update,
14 'created': podcast.created,
15 # modified is not indexed
16 'license': podcast.license, # maybe get a license name here?
17 'flattr_url': podcast.flattr_url,
18 'content_types': list(filter(None, podcast.content_types)),
19 'outdated': podcast.outdated,
20 'author': podcast.author,
21 'logo_url': podcast.logo_url,
22 # group, group_member_name ???
23 'subscribers': podcast.subscribers,
24 # restrictions ?
25 # common_episode_title
26 # new_location
27 'latest_episode_timestamp': podcast.latest_episode_timestamp,
28 'episode_count': podcast.episode_count,
29 # hub
30 'twitter': podcast.twitter,
31 # update_interval
32 'slugs': [s.slug for s in podcast.slugs.all()],
33 'urls': [u.url for u in podcast.urls.all()],
36 return doc