Ticket #6003: 00-admin-registration.diff
File 00-admin-registration.diff, 11.9 KB (added by , 17 years ago) |
---|
-
django/conf/app_template/admin.py
=== added file 'django/conf/app_template/admin.py'
1 from django.contrib import admin 2 import models 3 4 def register(site_admin): 5 pass # Register your models here. -
django/conf/project_template/admin.py
=== added file 'django/conf/project_template/admin.py'
1 from django.contrib import admin 2 3 # Import admins from your or contrib applications. 4 from django.contrib.auth import admin as auth_admin 5 from django.contrib.sites import admin as sites_admin 6 7 # Register admins from your or contrib applications. 8 admin_site = admin.AdminSite() 9 auth_admin.register(admin_site) 10 sites_admin.register(admin_site) -
django/contrib/auth/admin.py
=== added file 'django/contrib/auth/admin.py'
1 from django.utils.translation import ugettext as _ 2 from django.contrib import admin 3 from django.contrib.auth import models 4 5 class GroupAdmin(admin.ModelAdmin): 6 search_fields = ('name',) 7 filter_horizontal = ('permissions',) 8 9 class UserAdmin(admin.ModelAdmin): 10 fieldsets = ( 11 (None, {'fields': ('username', 'password')}), 12 (_('Personal info'), {'fields': ('first_name', 'last_name', 'email')}), 13 (_('Permissions'), {'fields': ('is_staff', 'is_active', 'is_superuser', 'user_permissions')}), 14 (_('Important dates'), {'fields': ('last_login', 'date_joined')}), 15 (_('Groups'), {'fields': ('groups',)}), 16 ) 17 list_display = ('username', 'email', 'first_name', 'last_name', 'is_staff') 18 list_filter = ('is_staff', 'is_superuser') 19 search_fields = ('username', 'first_name', 'last_name', 'email') 20 filter_horizontal = ('user_permissions',) 21 22 def add_view(self, request): 23 from django.contrib.admin.views.auth import user_add_stage 24 return user_add_stage(request) 25 26 def register(admin_site): 27 admin_site.register(models.Group, GroupAdmin) 28 admin_site.register(models.User, UserAdmin) -
django/contrib/comments/admin.py
=== added file 'django/contrib/comments/admin.py'
1 from django.contrib import admin 2 from django.contrib.comments import models 3 4 class CommentAdmin(admin.ModelAdmin): 5 fieldsets = ( 6 (None, {'fields': ('content_type', 'object_id', 'site')}), 7 ('Content', {'fields': ('user', 'headline', 'comment')}), 8 ('Ratings', {'fields': ('rating1', 'rating2', 'rating3', 'rating4', 'rating5', 'rating6', 'rating7', 'rating8', 'valid_rating')}), 9 ('Meta', {'fields': ('is_public', 'is_removed', 'ip_address')}), 10 ) 11 list_display = ('user', 'submit_date', 'content_type', 'get_content_object') 12 list_filter = ('submit_date',) 13 date_hierarchy = 'submit_date' 14 search_fields = ('comment', 'user__username') 15 raw_id_fields = ('user',) 16 17 class FreeCommentAdmin(admin.ModelAdmin): 18 fieldsets = ( 19 (None, {'fields': ('content_type', 'object_id', 'site')}), 20 ('Content', {'fields': ('person_name', 'comment')}), 21 ('Meta', {'fields': ('submit_date', 'is_public', 'ip_address', 'approved')}), 22 ) 23 list_display = ('person_name', 'submit_date', 'content_type', 'get_content_object') 24 list_filter = ('submit_date',) 25 date_hierarchy = 'submit_date' 26 search_fields = ('comment', 'person_name') 27 28 def register(admin_site): 29 admin_site.register(models.Comment, CommentAdmin) 30 admin_site.register(models.FreeComment, FreeCommentAdmin) -
django/contrib/flatpages/admin.py
=== added file 'django/contrib/flatpages/admin.py'
1 from django.contrib import admin 2 from django.contrib.flatpages import models 3 4 class FlatPageAdmin(admin.ModelAdmin): 5 fieldsets = ( 6 (None, {'fields': ('url', 'title', 'content', 'sites')}), 7 ('Advanced options', {'classes': 'collapse', 'fields': ('enable_comments', 'registration_required', 'template_name')}), 8 ) 9 list_filter = ('sites',) 10 search_fields = ('url', 'title') 11 12 def register(admin_site): 13 admin_site.register(models.FlatPage, FlatPageAdmin) -
django/contrib/redirects/admin.py
=== added file 'django/contrib/redirects/admin.py'
1 from django.contrib import admin 2 from django.contrib.redirects import models 3 4 class RedirectAdmin(admin.ModelAdmin): 5 list_filter = ('site',) 6 search_fields = ('old_path', 'new_path') 7 8 def register(admin_site): 9 admin_site.register(models.Redirect, RedirectAdmin) 10 -
django/contrib/sites/admin.py
=== added file 'django/contrib/sites/admin.py'
1 from django.contrib import admin 2 from django.contrib.sites import models 3 4 class SiteAdmin(admin.ModelAdmin): 5 list_display = ('domain', 'name') 6 search_fields = ('domain', 'name') 7 8 def register(site): 9 site.register(models.Site, SiteAdmin) -
django/conf/project_template/urls.py
=== modified file 'django/conf/project_template/urls.py'
1 1 from django.conf.urls.defaults import * 2 2 3 3 # Uncomment this for admin: 4 # from django.contribimport admin4 #import admin 5 5 6 6 urlpatterns = patterns('', 7 7 # Example: … … 11 11 #(r'^admin/doc/', include('django.contrib.admindocs.urls')), 12 12 13 13 # Uncomment this for admin: 14 #('^admin/(.*)', admin. site.root),14 #('^admin/(.*)', admin.admin_site.root), 15 15 ) -
django/contrib/admin/__init__.py
=== modified file 'django/contrib/admin/__init__.py'
1 1 from django.contrib.admin.options import ModelAdmin 2 2 from django.contrib.admin.options import StackedInline, TabularInline 3 from django.contrib.admin.sites import AdminSite , site3 from django.contrib.admin.sites import AdminSite -
django/contrib/admin/sites.py
=== modified file 'django/contrib/admin/sites.py'
300 300 # This global object represents the default admin site, for the common case. 301 301 # You can instantiate AdminSite in your own code to create a custom admin site. 302 302 site = AdminSite() 303 -
django/contrib/auth/models.py
=== modified file 'django/contrib/auth/models.py'
364 364 365 365 def is_authenticated(self): 366 366 return False 367 368 # Register the admin options for these models.369 # TODO: Maybe this should live in a separate module admin.py, but how would we370 # ensure that module was loaded?371 372 from django.contrib import admin373 374 class GroupAdmin(admin.ModelAdmin):375 search_fields = ('name',)376 filter_horizontal = ('permissions',)377 378 class UserAdmin(admin.ModelAdmin):379 fieldsets = (380 (None, {'fields': ('username', 'password')}),381 (_('Personal info'), {'fields': ('first_name', 'last_name', 'email')}),382 (_('Permissions'), {'fields': ('is_staff', 'is_active', 'is_superuser', 'user_permissions')}),383 (_('Important dates'), {'fields': ('last_login', 'date_joined')}),384 (_('Groups'), {'fields': ('groups',)}),385 )386 list_display = ('username', 'email', 'first_name', 'last_name', 'is_staff')387 list_filter = ('is_staff', 'is_superuser')388 search_fields = ('username', 'first_name', 'last_name', 'email')389 filter_horizontal = ('user_permissions',)390 391 def add_view(self, request):392 from django.contrib.admin.views.auth import user_add_stage393 return user_add_stage(request)394 395 admin.site.register(Group, GroupAdmin)396 admin.site.register(User, UserAdmin) -
django/contrib/comments/models.py
=== modified file 'django/contrib/comments/models.py'
273 273 274 274 def __repr__(self): 275 275 return _("Moderator deletion by %r") % self.user 276 277 # Register the admin options for these models.278 # TODO: Maybe this should live in a separate module admin.py, but how would we279 # ensure that module was loaded?280 281 from django.contrib import admin282 283 class CommentAdmin(admin.ModelAdmin):284 fieldsets = (285 (None, {'fields': ('content_type', 'object_id', 'site')}),286 ('Content', {'fields': ('user', 'headline', 'comment')}),287 ('Ratings', {'fields': ('rating1', 'rating2', 'rating3', 'rating4', 'rating5', 'rating6', 'rating7', 'rating8', 'valid_rating')}),288 ('Meta', {'fields': ('is_public', 'is_removed', 'ip_address')}),289 )290 list_display = ('user', 'submit_date', 'content_type', 'get_content_object')291 list_filter = ('submit_date',)292 date_hierarchy = 'submit_date'293 search_fields = ('comment', 'user__username')294 raw_id_fields = ('user',)295 296 class FreeCommentAdmin(admin.ModelAdmin):297 fieldsets = (298 (None, {'fields': ('content_type', 'object_id', 'site')}),299 ('Content', {'fields': ('person_name', 'comment')}),300 ('Meta', {'fields': ('submit_date', 'is_public', 'ip_address', 'approved')}),301 )302 list_display = ('person_name', 'submit_date', 'content_type', 'get_content_object')303 list_filter = ('submit_date',)304 date_hierarchy = 'submit_date'305 search_fields = ('comment', 'person_name')306 307 admin.site.register(Comment, CommentAdmin)308 admin.site.register(FreeComment, FreeCommentAdmin) -
django/contrib/flatpages/models.py
=== modified file 'django/contrib/flatpages/models.py'
25 25 26 26 def get_absolute_url(self): 27 27 return self.url 28 29 # Register the admin options for these models.30 # TODO: Maybe this should live in a separate module admin.py, but how would we31 # ensure that module was loaded?32 33 from django.contrib import admin34 35 class FlatPageAdmin(admin.ModelAdmin):36 fieldsets = (37 (None, {'fields': ('url', 'title', 'content', 'sites')}),38 ('Advanced options', {'classes': 'collapse', 'fields': ('enable_comments', 'registration_required', 'template_name')}),39 )40 list_filter = ('sites',)41 search_fields = ('url', 'title')42 43 admin.site.register(FlatPage, FlatPageAdmin) -
django/contrib/redirects/models.py
=== modified file 'django/contrib/redirects/models.py'
18 18 19 19 def __unicode__(self): 20 20 return "%s ---> %s" % (self.old_path, self.new_path) 21 22 # Register the admin options for these models.23 # TODO: Maybe this should live in a separate module admin.py, but how would we24 # ensure that module was loaded?25 26 from django.contrib import admin27 28 class RedirectAdmin(admin.ModelAdmin):29 list_filter = ('site',)30 search_fields = ('old_path', 'new_path')31 32 admin.site.register(Redirect, RedirectAdmin)33 -
django/contrib/sites/models.py
=== modified file 'django/contrib/sites/models.py'
42 42 def __unicode__(self): 43 43 return self.domain 44 44 45 # Register the admin options for these models.46 # TODO: Maybe this should live in a separate module admin.py, but how would we47 # ensure that module was loaded?48 49 from django.contrib import admin50 51 class SiteAdmin(admin.ModelAdmin):52 list_display = ('domain', 'name')53 search_fields = ('domain', 'name')54 55 admin.site.register(Site, SiteAdmin)56 57 45 class RequestSite(object): 58 46 """ 59 47 A class that shares the primary interface of Site (i.e., it has