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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:35:27+00:00 2026-05-20T04:35:27+00:00

Im prepping for developing one project and am in process of mapping out stuff

  • 0

Im prepping for developing one project and am in process of mapping out stuff i can use for it. This project is going to need different group/user based model & object permissions and settings.

I know i can use django-objectpermissions (https://github.com/washingtontimes/django-objectpermissions) and djangos own model permissions. But there are some cases, when you dont really need to set object/model permissions, but rather a setting – can this account/user do something, which is not related to certain object or model. Has someone developed app for this? Or what kind of approach do people take when they have such need? Perhaps create dummy django model and let djangos model permissions handle the rest?

I also know, that this does something similar – https://github.com/danielroseman/django-dbsettings. But when i skimmed through the code i got impression, that those settings are all user based – i need also group based settings.

Edit: People keep offering me permissions apps. What i am looking for is not permissions app, but settings app. Those settings/permissions are not related to any objects.

Basically. In my project i need to answer questions – Can this user see/do this thing?. That “thing” is most likely a view. So one of the answers almost works. But the check i do at view, is not if user has permission to some model/object. Its rather, if the user has this setting turned on, of if users group has this setting turned on.

Alan

  • 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-20T04:35:27+00:00Added an answer on May 20, 2026 at 4:35 am

    You’re probably going to need to create your own system for this. It shouldn’t be very difficult.

    class Setting(models.Model):
        name = models.CharField(..)
        value = models.CharField(..)
        users = models.ManyToManyField(User)
        groups = models.ManyToManyField(Group)
    
        @classmethod
        def has_setting(cls, name, user):
            user_settings = cls.objects.filter(name=name, users__in=[user]).count()
            group_settings = cls.objects.filter(name=name, groups__in=user.groups.all()).count()
            return user_settings or group_settings
    
        @classmethod
        def get_settings(cls, name, user, priority=User):
            user_settings = list(cls.objects.filter(name=name, users__in=[user]))
            group_settings = list(cls.objects.filter(name=name, groups__in=user.groups.all()))
            if user_settings and not group_settings: 
                return user_settings
            elif group_settings and not user_settings:
                return group_settings
            else:
                return (group_settings, user_settings)[priority==User]
    

    Then you can do something like this in your views:

    def display_frob(request):
        if Setting.has_setting('display_frob', request.user):
             settings = Setting.get_setting('display_from', request.user, priority=Group)
             values = [setting.value for setting in settings]
             # if the User was in many groups, we now have a list of values, for the setting
             # `display_frob`, that aligns with each of those groups
    

    You can easy build a decorator which will do the check, and provide a list (or a single item) of values to the view.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm prepping for a simple work project and am trying to familiarize myself with
This question is related to another question I just posted . I'm prepping for
This is more of a theoretical question than a specific one. I have a
I'm prepping for the SCJP, and multithreading has been my shakiest area, mostly because
I'm prepping for my first update (1.0.1) on the AppStore and will be changing
I'm an assistant sysadmin for my university's CS department. We're prepping a new image
So I am very new to web development and working on a new project
In prepping the objects for a game I'm making in javscript, I'm reading in
I'm prepping for interviews, and some obvious interview questions such as counting frequency of
For the purposes of teaching and preparing written instructions about R, one of the

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.