I have a site with Django running some custom apps. I was not using the Django ORM, just the view and templates but now I need to store some info so I created some models in one app and enabled the Admin.
The problem is when I log in the Admin it just says "You don't have permission to edit anything", not even the Auth app shows in the page. I'm using the same user created with syncdb as a superuser.
In the same server I have another site that is using the Admin just fine.
Using Django 1.1.0 with Apache/2.2.10 mod_python/3.3.1 Python/2.5.2, with psql (PostgreSQL) 8.1.11 all in Gentoo Linux 2.6.23
Any ideas where I can find a solution?
Thanks a lot.
UPDATE: It works from the development server. I bet this has something to do with some filesystem permission but I just can't find it.
UPDATE2: vhost configuration file:
<Location />
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE gpx.settings
PythonDebug On
PythonPath "['/var/django'] + sys.path"
</Location>
UPDATE 3: more info
UPDATE 4: confirmed that the settings file is the same for apache and runserver (renamed it and both broke)
UPDATE 5: /var/django/gpx/contable/init.py exists
This is the relevan part of urls.py:
urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
)
urlpatterns += patterns('gpx',
(r'^$', 'menues.views.index'),
(r'^adm/$', 'menues.views.admIndex'),
Add Permissions to a Group If you are using AbstractUser in Django, you must add AUTH_USER_MODEL = 'YourAppName. YourClassName' . This way, you are telling Django to use our custom user model instead of the default one. The code below should go in your admin.py file so that you can see your user model.
The Django admin site uses permissions as follows: Access to view objects is limited to users with the “view” or “change” permission for that type of object. Access to view the “add” form and add an object is limited to users with the “add” permission for that type of object.
Hopefully this helps someone, but we had this same problem because someone added a different authentication backend to settings.py and did not keep the default ModelBackend. Changing the setting to:
AUTHENTICATION_BACKENDS = (
'auth.authentication.EmailBackend',
'django.contrib.auth.backends.ModelBackend',
)
fixed it for us.
It sounds like you haven't registered any apps with the admin (step 5 in this overview).
Try adding the line admin.autodiscover()
to your main urls.py, making sure to do from django.contrib import admin
first.
For example:
# Other imports...
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
('^admin/', include(admin.site.urls)),
# Other URL patterns...
)
You can also register your models individually with admin.site.register(YourModel)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With