Show More
@@ -1,31 +1,31 b'' | |||
|
1 | 1 | from django.core.urlresolvers import reverse |
|
2 | 2 | from django.shortcuts import get_object_or_404, render |
|
3 | 3 | |
|
4 | 4 | from boards import settings |
|
5 | 5 | from boards.abstracts.paginator import get_paginator |
|
6 | 6 | from boards.models import Tag |
|
7 | 7 | from boards.views.base import BaseBoardView |
|
8 | 8 | from boards.views.mixins import PaginatedMixin |
|
9 | 9 | |
|
10 | 10 | IMAGES_PER_PAGE = settings.get_int('View', 'ImagesPerPageGallery') |
|
11 | 11 | |
|
12 | 12 | TEMPLATE = 'boards/tag_gallery.html' |
|
13 | 13 | |
|
14 | 14 | |
|
15 | 15 | class TagGalleryView(BaseBoardView, PaginatedMixin): |
|
16 | 16 | |
|
17 | 17 | def get(self, request, tag_name): |
|
18 | 18 | page = int(request.GET.get('page', 1)) |
|
19 | 19 | |
|
20 | 20 | params = dict() |
|
21 | 21 | tag = get_object_or_404(Tag, name=tag_name) |
|
22 | 22 | params['tag'] = tag |
|
23 | 23 | paginator = get_paginator(tag.get_images(), IMAGES_PER_PAGE, |
|
24 | 24 | current_page=page) |
|
25 | 25 | params['paginator'] = paginator |
|
26 | 26 | params['images'] = paginator.page(page).object_list |
|
27 | 27 | paginator.set_url(reverse('tag_gallery', kwargs={'tag_name': tag_name}), |
|
28 | 28 | request.GET.dict()) |
|
29 |
self. |
|
|
29 | params.update(self.get_page_context(paginator, page)) | |
|
30 | 30 | |
|
31 | return render(request, TEMPLATE, params) No newline at end of file | |
|
31 | return render(request, TEMPLATE, params) |
General Comments 0
You need to be logged in to leave comments.
Login now