Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
django-opds/opds/views.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
29 lines (26 sloc)
1.04 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding: utf-8 -*- | |
from django.urls import reverse | |
from django.http import HttpResponse, Http404, HttpResponseRedirect | |
from django.shortcuts import get_object_or_404, render | |
from django.views import generic | |
from eoapublications.models import Publication | |
from eoaseries.models import Series | |
from .models import Catalogue | |
def opds_root(request): | |
allseries = Series.objects.all().order_by('name') | |
latestbook = Publication.objects.all().order_by('-Datepublished')[0].Datepublished | |
Content = { | |
'Series' : allseries, | |
'Lastchange' : latestbook, | |
} | |
return render(request, 'opds/root.xml', Content) | |
def opds_series(request, path): | |
current_series = path | |
series_overview = Publication.objects.filter(Published=True, Serie=path) | |
latestbook = Publication.objects.filter(Published=True, Serie=path).order_by('-Datepublished')[0].Datepublished | |
Content = { | |
'Series' : current_series, | |
'Books' : series_overview, | |
'Lastchange' : latestbook, | |
} | |
return render(request, 'opds/series.xml', Content) |