queryset = Album.objects.order_by('-name')
paginate_by = 20
- def get_context_data(self, **kwargs):
- context = super(AlbumListView, self).get_context_data(**kwargs)
- return context
-
class PhotoListView(ListView):
model = Photo
paginate_by = 20
order_by = 'order, image'
def get_queryset(self):
- album = Album.objects.get(slug__exact=self.kwargs['slug'])
- return Photo.objects.filter(album=album)
+ try:
+ album = Album.objects.get(slug__exact=self.kwargs['slug'])
+ return Photo.objects.filter(album=album)
+ except:
+ raise Http404
class PhotoView(DetailView):
- model = Photo
+
+ def get_queryset(self, **kwargs):
+ return Photo.objects.get(id=self.kwargs['id']).get_queryset()
def get_object(self, **kwargs):
- return Photo.objects.get(id=self.kwargs['id'])
+ try:
+ photo = Photo.objects.get(id=self.kwargs['id'])
+ return photo
+ except:
+ raise Http404
def get_context_data(self, **kwargs):
context = super(PhotoView, self).get_context_data(**kwargs)
context['prev_photo'] = prev_photo
return context
-
('Brett Parker', 'iDunno@sommitrealweird.co.uk'),
)
+ALLOWED_HOSTS = [
+ "www.sommitrealweird.co.uk",
+ "www.sommitrealweird.co.uk.",
+]
+
MANAGERS = ADMINS
DATABASES = {