Saturday, September 25, 2010

Re: The REAL superuser

Thanks for replying so quickly.

I thought that since I could not find the problem, I'll just paste the contents of the files into an email.

# models.py

from django.db import models
from django.contrib import admin
from blog import posts

class Posts(models.Model):
title = models.CharField(max_length=30, verbose_name='Title')
body = models.TextField(verbose_name='Body')
def __unicode__(self):
return self.title


# admin.py

from django.db import models
from django.contrib import admin
from blog import posts

class PostsAdmin(admin.ModelAdmin):
list_display = ('title', 'body')

admin.site.register(Posts, PostsAdmin)

# urls.py

from django.conf.urls.defaults import *
from django.contrib import admin
from blog import posts

admin.autodiscover()

urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
)

Thanks!

On Fri, Sep 24, 2010 at 10:41 PM, Karen Tracey <kmtracey@gmail.com> wrote:
On Fri, Sep 24, 2010 at 6:02 PM, aug dawg <augdawg09@gmail.com> wrote:
Hey all,

I'm currently learning how to use Django, so earlier this evening I spent about 30 minutes working on a blog engine. I used the admin interface and ran 'python manage.py syncdb'. I then run the dev server. I log in to the admin interface successfully, but then it says I don't have permission to edit anything. I even manually created a superuser. Can anyone help me out?


Admin says you don't have permission to edit anything regardless of your superuser status when it there have been no models registered for it to manage. So either there are no admin.py files in any of the INSTALLED_APPS or (more likely) the admin.autodiscover() call in urls.py has been left commented out (part of the instructions for enabling the admin include uncommenting that line. The admin.autodiscover() call is what ensures the registrations done in admin.py files in all installed apps are actually executed.

Karen
--
http://tracey.org/kmt/

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment