Questions tagged [django-permissions]

django-permissions is a pluggable django app that provides per-object permissions for Django based on roles

django-permissions is a pluggable django app that provides per-object permissions for Django based on roles.

431 questions
6
votes
1 answer

ModelAdmin thread-safety/caching issues

Ultimately, my goal is to extend Django's ModelAdmin to provide field-level permissions—that is, given properties of the request object and values of the fields of the object being edited, I would like to control whether or not the fields/inlines…
c_harm
6
votes
3 answers

How to limit access to the UpdateView of an object to the creator of that object

Django and programming noob here. I've made an application I'd like to deploy, but I need to figure out how to limit access to the UpdateView to the creator of that object, and I'm stumped. Currently a user can use the CreateView…
Mitch Downey
  • 887
  • 1
  • 11
  • 15
6
votes
2 answers

Django Groups and Permissions. Extending Groups to have a FK?

I'm working on a product that allows different schools to administer their content online. Part of this involves setting up a role based access control logic which I've written myself. Essentially, each school has its own set of roles that have…
super9
  • 29,181
  • 39
  • 119
  • 172
5
votes
2 answers

Handle permission cache in django user model

I stumbled upon a weird behaviour: I add a permission to a user object but the permission check fails. permission = Permission.objects.get_by_natural_key(app_label='myapp', codename='my_codename',…
Ron
  • 22,128
  • 31
  • 108
  • 206
5
votes
4 answers

How to make group permissions work in Django-nonrel for Google App Engine

I'm trying to get role-based permissions working for django-nonrel for GAE. Out of the box, it didn't seem to work, probably because of the implicit many-to-many relationship between Users and Groups, so I found and installed…
5
votes
1 answer

Django UserPassesTestMixin confusion/questions?

I am currently working on an admin dashboard, which include specific views for company administrators only which are labeled as Business users. The app is going to have about 10 views, and I had a few questions in regards to the…
5
votes
2 answers

Remove user's permissions (django)

I have an issue with removing permissions to users in view or even in the shell. Let me explain my problem: I did those tests in the shell: org = Organisateur.objects.get(user__username__contains="ghj") content_type =…
karna
  • 61
  • 2
  • 4
5
votes
6 answers

Django: Inherit Permissions from abstract models?

Is it possible to inherit permissions from an abstract model in Django? I can not really find anything about that. For me this doesn't work! class PublishBase(models.Model): class Meta: abstract = True get_latest_by = 'created' …
Bernhard Vallant
  • 49,468
  • 20
  • 120
  • 148
5
votes
2 answers

Django::OperationalError at /admin/login/ unable to open database file

I know there's already a same question, i too tried the solutions given their but it dint work for me hence i am writing my own question. Hii all, i am deploying django server using apache2 server and when i tried my host Ip address it works fine as…
jay j
  • 285
  • 1
  • 6
  • 16
5
votes
1 answer

Register user in Django REST framework and set group for user

My user class is: class UserProfile(User): sex = models.SmallIntegerField(verbose_name=_(u'sex'), choices=SEX_TYPES, default=1) . . UserProfileSerializer: class ProfileSerializer(serializers.ModelSerializer): groups =…
TheNone
  • 5,684
  • 13
  • 57
  • 98
5
votes
2 answers

Django admin - giving users access to specific objects/fields?

I need to make an "owners" login for the admin. Say we have this model structure: class Product(models.Model): owner = models.ManyToManyField(User) name = models.CharField(max_length=255) description = models.CharField(max_length=255) …
antihero
  • 423
  • 5
  • 10
4
votes
1 answer

Overwrite Django permission and modify auth_permission

I want to create the permissions in views dynamically instead of the defaults at models I create a main class called CreatorView from django.views.generic import View from django.forms.models import modelform_factory class CreatorView(View): …
AlASAD WAIL
  • 775
  • 4
  • 18
4
votes
1 answer

How to use logical operators in DRF's DEFAULT_PERMISSION_CLASSES?

Since DRF==3.9--(release notes) we have got an option to combine/compose the permission classes in our views. class MyViewSet(...): permission_classes = [FooPermission & BarPermission] I did try something like this, REST_FRAMEWORK = { …
JPG
  • 82,442
  • 19
  • 127
  • 206
4
votes
1 answer

Django Migration from 2.0 to 2.2(View Permissions Issue)

While Migrating the Django Facing issue related to migration : python manage.py migrate demo --database demo Getting Error related to : ValueError: Cannot assign "ContentType: ContentType object (1)": the current database router prevents this…
4
votes
1 answer

Add staff user permissions in admin with custom user model

There are a number of questions about this, but they all seem slightly different to what I need. I have a custom user model in my core app in models.py in django: from django.db import models from django.contrib.auth.models import * from…
Davtho1983
  • 3,827
  • 8
  • 54
  • 105