0

At the moment Photologue is showing me 4 rows with 5 pictures on each row. I tried modifying it so I only see 5 pictures at once. I tried using paginate_by = 5 and put it in views.py and urls.py. But neither worked. Can anyone offer suggestions on how to customize the number of rows and columns that are shown?

enter image description here

views.py

from photologue.views import PhotoListView
from braces.views import JSONResponseMixin


class PhotoJSONListView(JSONResponseMixin, PhotoListView):
    paginate_by = 5
    def render_to_response(self, context, **response_kwargs):
        return self.render_json_object_response(context['object_list'],**response_kwargs)

urls.py

from django.urls import path
from .views import PhotoJSONListView

from photologue.views import GalleryListView

urlpatterns = [
    path(r'^photolist/$',
        PhotoJSONListView.as_view(paginate_by=5),
        name='photologue_custom-photo-json-list'),

path(r'^gallerylist/$',
    GalleryListView.as_view(paginate_by=20),
    name='photologue_custom-gallery-list'),



]
4

0 回答 0