+def book_json(request, slug):
+ qs = models.Audiobook.objects.filter(slug=slug).order_by(
+ "index"
+ )
+ return JsonResponse({
+ "items": [
+ {
+ "id": item.id,
+ "part": item.part_name,
+ "mp3_status": item.get_mp3_status_display(),
+ "ogg_status": item.get_ogg_status_display(),
+ "youtube_status": item.get_youtube_status_display(),
+ "project": {
+ "name": item.project.name,
+ "can_sell": item.project.can_sell,
+ }
+ }
+ for item in qs
+ ]
+ })
+