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

  • SEARCH
  • Home
  • 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 6089649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:07:25+00:00 2026-05-23T12:07:25+00:00

I’m currently writing a site which uses django-guardian to assign object-level permissions which are

  • 0

I’m currently writing a site which uses django-guardian to assign object-level permissions which are used throughout the site.

Here is the desired functionality:

I’d like for a user to have permissions to edit a single object (or multiple objects). For example, if there is a user named “Joe”, and a model named “Partyline”, I may give “Joe” specific permissions to “change_partyline” for 3 specific “Partyline” objects.

When Joe logs into the Django admin panel, I’d like him to be able to edit ONLY his 3 specific “Partyline” objects, since those are the only things he has permission to edit.

Here is the current functionality:

I can assign Joe change_partyline permissions to 3 Partyline objects–no problem. And Joe can log into the admin panel just fine. The problem is that since Joe doesn’t have “global” permissions to change ALL partylines, the admin panel says that he does not have any permissions, and won’t let him edit anything. I’d like to find a way for the admin to recognize that Joe has permissions to edit only 3 specific objects, and let him view and edit only those objects which he has permissions to work on.

I’d LOVE to find a way to make this work. I’m using the admin extensively for my users to manage things right now, and it would really break presentation to have to move certain functionality out of the admin to other areas on the site.

If you have any suggestions, please let me know!

For reference, here is some shell output demonstrating that the user has change_partyline permissions on a Partyline object:

>>> from django.contrib.auth.models import User
>>> u = User.objects.get(id=2)
>>> from apps.partylines.models import Partyline
>>> p = Partyline.objects.get(id=3)
>>> u.has_perm('partylines.change_partyline', p)
True

And here’s my partylines.admin module (which shows how the Partyline module is populated in the admin):

from django.contrib import admin
from guardian.admin import GuardedModelAdmin
from apps.partylines.models import Partyline


class PartylineAdmin(GuardedModelAdmin):
    list_display = ('did', 'name', 'listed')
    ordering = ('did',)
    search_fields = ('did', 'name')

admin.site.register(Partyline, PartylineAdmin)
  • 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-23T12:07:26+00:00Added an answer on May 23, 2026 at 12:07 pm

    I’ve asked a similar question to Lukazs (guardian’s author) and he told me that this feature is coming on a future release (see user_can_access_owned_objects_only property on this commit and the related issue). If you’re not willing to wait, maybe you can just install the source on the master branch.

    Have you thought about overriding queryset on your model? In my case was just enough:

    # models.py
    from django.db import models
    from django.contrib.auth import models as auth_models
    
    class MagazineUser(models.Model):
        user = models.ForeignKey(auth_models.User, unique=True)
    
    class Magazine(models.Model):
        managers = models.ForeignKey(MagazineUser)
    
    # admin.py
    
    class MagazineAdmin(admin.ModelAdmin):
        def queryset(self, request):
            qs = super(admin.ModelAdmin, self).queryset(request)
    
            if request.user.is_superuser:
                return qs
    
            user_qs = MagazineUser.objects.filter(user=request.user)
            return qs.filter(managers__in=user_qs)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have an autohotkey script which looks up a word in a bilingual dictionary
I have an array which has BIG numbers and small numbers in it. I

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.