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