سؤال

I am able to run a Django Admin site and when I login as the SuperUser I'm able to modify my model as well. This part works perfectly. When I login as a user that is NOT a super user, the user does not see an option to modify this Model. When I logged in as a Super User and tried to give this user/group the permission to modify this model from the permission list, I couldn't find this permission in the list.

I see the following permissions:

  • admin|log entry|
  • .
  • .
  • auth|group|...
  • auth|message|...
  • auth|permission|...
  • content types|...
  • sessions|...

but nothing related to my ModelAdmin. My admin.py looks as follows:

from django.contrib import admin
from pl.models import *

class MyModelAdmin(admin.ModelAdmin):
    pass

admin.site.register(MyModel, MyModelAdmin)

Can only a super-user edit models specified via ModelAdmin? What if I want to permission a group to be able to do so for select models. Any way to do this? Thanks.

هل كانت مفيدة؟

المحلول

If you've already run syncdb and the permissions are still not there, then you must not have your app listed in INSTALLED_APPS. Otherwise, Django would automatically create them.

Additionally, you mention "nothing related to my ModelAdmin". The permissions are created for models, not ModelAdmins. You may have just mistyped that, but if you're looking for something related to the ModelAdmin itself, that might be your problem.

نصائح أخرى

You should be able to do that. Try running python manage.py syncdb again.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top