Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5841721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:55:33+00:00 2026-05-22T11:55:33+00:00

In one of my views the following function being called like def post_list(request, page=0,

  • 0

In one of my views the following function being called like

def post_list(request, page=0, paginate_by=20, **kwargs):
  page_size = getattr(settings,'BLOG_PAGESIZE', paginate_by)
  return list_detail.object_list(
    request,
    queryset=Post.objects.published(),
    paginate_by=page_size,
    page=page,
    **kwargs
  )

I need to pass my a dictionary into page how can i do it..

/usr/mysite/django/django/views/generic list_detail.py

  def object_list(request, queryset, paginate_by=None, page=None,
          allow_empty=True, template_name=None, template_loader=loader,
          extra_context=None, context_processors=None, template_object_name='object',
          mimetype=None):
      """
      Generic list of objects.

      Templates: ``<app_label>/<model_name>_list.html``
      Context:
          object_list
              list of objects
          is_paginated
              are the results paginated?
          results_per_page
              number of objects per page (if paginated)
          has_next
              is there a next page?
          has_previous
              is there a prev page?
          page
              the current page
          next
              the next page
          previous
              the previous page
          pages
              number of pages, total
          hits
              number of objects, total
          last_on_page
              the result number of the last of object in the
              object_list (1-indexed)
          first_on_page
              the result number of the first object in the
              object_list (1-indexed)
          page_range:
              A list of the page numbers (1-indexed).
      """
      if extra_context is None: extra_context = {}
      queryset = queryset._clone()
      if paginate_by:
          paginator = Paginator(queryset, paginate_by, allow_empty_first_page=allow_empty)
          if not page:
              page = request.GET.get('page', 1)
          try:
              page_number = int(page)
          except ValueError:
              if page == 'last':
                  page_number = paginator.num_pages
              else:
                  # Page is not 'last', nor can it be converted to an int.
                  raise Http404
          try:
              page_obj = paginator.page(page_number)
          except InvalidPage:
              raise Http404
          c = RequestContext(request, {
              '%s_list' % template_object_name: page_obj.object_list,
              'paginator': paginator,
              'page_obj': page_obj,

              # Legacy template context stuff. New templates should use page_obj
              # to access this instead.
              'is_paginated': page_obj.has_other_pages(),
              'results_per_page': paginator.per_page,
              'has_next': page_obj.has_next(),
              'has_previous': page_obj.has_previous(),
              'page': page_obj.number,
              'next': page_obj.next_page_number(),
              'previous': page_obj.previous_page_number(),
              'first_on_page': page_obj.start_index(),
              'last_on_page': page_obj.end_index(),
              'pages': paginator.num_pages,
              'hits': paginator.count,
              'page_range': paginator.page_range,
          }, context_processors)
      else:
          c = RequestContext(request, {
              '%s_list' % template_object_name: queryset,
              'paginator': None,
              'page_obj': None,
              'is_paginated': False,
          }, context_processors)
          if not allow_empty and len(queryset) == 0:
              raise Http404
      for key, value in extra_context.items():
          if callable(value):
              c[key] = value()
          else:
              c[key] = value
      if not template_name:
          model = queryset.model
          template_name = "%s/%s_list.html" % (model._meta.app_label, model._meta.object_name.lower())
      t = template_loader.get_template(template_name)
      return HttpResponse(t.render(c), mimetype=mimetype)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T11:55:34+00:00Added an answer on May 22, 2026 at 11:55 am

    Have you tried using extra_context variable of django generic view?

    def post_list(request, page=0, paginate_by=20, **kwargs):
      page_size = getattr(settings,'BLOG_PAGESIZE', paginate_by)
      return list_detail.object_list(
        request,
        queryset=Post.objects.published(),
        paginate_by=page_size,
        page=page,
        extra_context={'my':dict},
        **kwargs
      )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.