You don't have permission to edit anything

周末没事在家捣腾Django ,使用的最新版本1.1, 启用'django.contrib.admin'后login到admin显示"You don't have permission to edit anything", 查了下文档[url]http://docs.djangoproject.com/en/dev/ref/contrib/admin/#hooking-adminsite-instances-into-your-urlconf[/url],发现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.

[url=http://docs.djangoproject.com/en/dev/ref/contrib/admin/#modeladmin-objects]ModelAdmin objects [/url]
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)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值