`
lxneng
  • 浏览: 188218 次
  • 性别: Icon_minigender_1
  • 来自: 火星
社区版块
存档分类
最新评论

You don't have permission to edit anything

阅读更多
周末没事在家捣腾Django ,使用的最新版本1.1, 启用'django.contrib.admin'后login到admin显示"You don't have permission to edit anything", 查了下文档http://docs.djangoproject.com/en/dev/ref/contrib/admin/#hooking-adminsite-instances-into-your-urlconf,发现admin.autodiscover()这行注释没去掉,再试就可以编辑了。

# urls.py
from django.conf.urls.defaults import *
from django.contrib import admin

admin.autodiscover()

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

Above we used admin.autodiscover() to automatically load the INSTALLED_APPS admin.py modules.

ModelAdmin objects
class ModelAdmin
The ModelAdmin class is the representation of a model in the admin interface. These are stored in a file named admin.py in your application. Let’s take a look at a very simple example of the ModelAdmin:
from django.contrib import admin
from myproject.myapp.models import Author

class AuthorAdmin(admin.ModelAdmin):
    pass
admin.site.register(Author, AuthorAdmin)
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics