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 9260485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:54:14+00:00 2026-06-18T12:54:14+00:00

The problem I have is that I want to use a view (rather not

  • 0

The problem I have is that I want to use a view (rather not modifing it) to show all person in a group.
The problem is I don’t know how to use the pk in the regex to filter in the same line…

I wanted something like:

url(r'^groups/(?P<pk>\d+)/$', login_required(MyListView.as_view(model=Person, queryset=Person.objects.filter(groups__id=pk))), name='person_group_list'),

With this I get:
“NameError at /clients/

name ‘pk’ is not defined”

Any hint?

  • 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-06-18T12:54:15+00:00Added an answer on June 18, 2026 at 12:54 pm

    You really need to write a view. That’s the advantage of class based views, you can simply inherit from MyListView. (I know you said you didn’t want to do this, but it really is the right way to go).

    from your_app.views import MyListView
    from your_app.models import Person
    
    class MySpecialListView(MyListView):
        model = Person
        get_queryset(self, *args, **kwargs):
            return Person.objects.filter(groups__id=self.kwargs['group_pk']))
    

    As a side note, I would change pk to group_pk in your regex to avoid any possible conflicts.

    url(r'^groups/(?P<group_pk>\d+)/$', login_required(MySpecialListView.as_view(), name='person_group_list')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My problem is that I want to have a tab bar view with its
with my RCP program I have the problem that I want to have more
I have a problem with my site. I want that the shadow stops at
I have the following problem that I want to solve in awk. I have
My problem is simple: I have a long list of elements that I want
I have problem with fancybox. I want to write a function that will run
I have a big problem. I want to extract text from html table that
I have the following problem. I want to check that the item clicked on
Very simple problem: I have a Public Sub (in a module) that I want
I have a UIPopover that I want to use either -(BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController{ return NO;

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.