django1.7新特性

By liuzhijun, 2014-04-03, 分类: 默认

django

Th

The register decorator

register(*models[, site=django.admin.sites.site])

There is also a decorator for registering your ModelAdmin classes:

from django.contrib import admin
from .models import Author

@admin.register(Author)
class AuthorAdmin(admin.ModelAdmin):
    pass

关注公众号「Python之禅」(id:vttalk)获取最新文章 python之禅

猜你喜欢

2014-03-31
Django Signals 从实践到源码分析
2014-01-18
Django+Ubuntu+Nginx+Gunicorn应用部署
2014-02-25
仅仅是一个轮子
2014-02-08
Django url()函数详解
2014-03-21
Django-Compressor 静态文件压缩
2014-02-08
Django自定义User模型