django-permissions Questions

2

i am trying to add custom permissions in my Django app using Django rest framework. i created an API n tested it in postman it works fine for authenticated user. however it doesnt display details w...
Detonator asked 20/7, 2018 at 6:55

5

in django by default when syncdb is run with django.contrib.auth installed, it creates default permissions on each model... like foo.can_change , foo.can_delete and foo.can_add. To add custom permi...
Shipmaster asked 11/10, 2011 at 9:57

4

Solved

I have my own custom User model, and its own Manger too. models: class MyUser(AbstractBaseUser, PermissionsMixin): email = models.EmailField(max_length=255, unique=True) first_name = models.Ch...
Passional asked 12/11, 2015 at 14:56

5

Solved

I'm writing an application with the Django Rest Framework. I created a custom permission. I provided a message attribute to the custom permission, but still the default detail gets returned. Let ...

9

Solved

I'd like to use a permissions based system to restrict certain actions within my Django application. These actions need not be related to a particular model (e.g. access to sections in the applicat...
Release asked 18/12, 2012 at 12:14

4

Solved

Today i came up with a requirement where i need to implement field level permission so looking for the best possible way. class ABC(models.Model): field1 = ..... field2 = ..... field3 = ..... ...
Cohabit asked 5/12, 2013 at 11:6

7

Solved

Is there a best practice to assign a different permission to each action of a given APIView or ViewSet? Let's suppose I defined some permissions classes such as 'IsAdmin', 'IsRole1', 'IsRole2', ......
Typhoid asked 11/10, 2013 at 8:9

11

Solved

How to check in template whether user belongs to some group? It is possible in a view which is generating the template but what if I want to check this in base.html which is an extending template...
Footwear asked 2/1, 2016 at 23:40

3

Solved

I looked through similar questions on the same topic and I think I am following all the rules specified for has_object_permission. This is what I have in my settings. REST_FRAMEWORK = { 'DEFAULT...
Boyish asked 20/2, 2019 at 9:55

2

Solved

I added some permissions to a user via the admin interface. From some reason all the perm functions fail, e.g >>> user.get_all_permissions() set([]) But accessing the table directly, w...

2

The situation is pretty simple: I'm writing a multi-user blog system. The system should prevent non-owner to edit or delete a blog post. In my view I use generic view. class BlogUpdateView(UpdateV...
Hauptmann asked 26/4, 2012 at 3:45

2

Solved

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', ...
Parity asked 19/8, 2021 at 7:9

2

Solved

I have a group EuropartsBuyer and model named Product. The following code adds a permission to the Product model. class Meta: permissions = ( ("can_add_cost_price", "Can add cost price"), ) ...
Taratarabar asked 6/2, 2017 at 8:26

2

Solved

I am building an app with multiple roles defined through Django Groups. I started with a custom user model, defined as below. I am seeing a weird difference in the groups and permissions use when u...
Mountebank asked 13/7, 2020 at 8:26

2

Solved

I couldn't find a solution to my problem and would appreciate comments/help on this. I would like to develop a multiple user type model in Django, along the lines of this video where the author is ...
Fanion asked 28/6, 2021 at 17:55

5

Solved

I wanted to add some groups and assign permissions to them in a manually written migration but if I run it on a clean DB it creates permissions only after running all migrations. I've found this t...
Janot asked 30/7, 2015 at 22:18

1

Solved

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 ...

2

Solved

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 ...
Shellback asked 25/2, 2015 at 10:34

3

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. Curren...
Officiate asked 28/8, 2013 at 0:51

5

Solved

From the admin I see that you can allocate permissions to a user or a user group to :allow add, change or delete data from a model. That is great, but I also need to allow a user or a user group t...

1

Solved

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 o...
Maganmagana asked 30/5, 2019 at 11:10

3

Solved

I would like to execute the following migration: # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib.auth.models import Permission from django.db import migrations ...

4

Solved

There is from guardian.shortcuts import get_objects_for_user But what about from guardian.shortcuts import get_users_for_object Thanks.
Charmain asked 28/2, 2013 at 14:35

2

Solved

I have a basic Viewset: class UsersViewSet(viewsets.ModelViewSet): permission_classes = (OnlyStaff,) queryset = User.objects.all() serializer_class = UserSerializer It is bind to the /api/use...
Uproot asked 27/9, 2018 at 19:25

1

I'm trying to add new migrations by following this tutorial I added new permission inside Meta into permissions field. Then I created migration and tryed to modify this migration to update group pe...
Retardation asked 1/5, 2018 at 9:53

© 2022 - 2024 — McMap. All rights reserved.