From ea60c836f336f4c4730f925b78b3d36a9661dad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20Ka=CC=88ser?= Date: Mon, 10 Aug 2015 13:17:06 +0200 Subject: [PATCH] container image name can safely be changed; A-z ordering --- ipynbsrv/admin/admin.py | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/ipynbsrv/admin/admin.py b/ipynbsrv/admin/admin.py index 5cfcdc5..4cfd7bc 100644 --- a/ipynbsrv/admin/admin.py +++ b/ipynbsrv/admin/admin.py @@ -322,7 +322,7 @@ def get_readonly_fields(self, request, obj=None): :inherit. """ if obj: - return ['backend_pk', 'command', 'name', 'protected_port', 'public_ports', 'owner'] + return ['backend_pk', 'command', 'protected_port', 'public_ports', 'owner'] return [] @@ -592,12 +592,33 @@ def get_fieldsets(self, request, obj=None): }) ] + def get_readonly_fields(self, request, obj=None): + """ + :inherit. + """ + if obj is not None and hasattr(obj, 'backend_user'): + return ['groups', 'is_staff', 'username'] + else: + return ['is_staff'] + def get_urls(self): + """ + TODO. + """ urls = super(UserAdmin, self).get_urls() my_urls = patterns('', (r'^import_users/$', self.import_users)) return my_urls + urls + def has_add_permission(self, request): + """ + :inherit. + """ + return False + def import_users(self, request): + """ + TODO. + """ # custom view which should return an HttpResponse try: # Todo: imports @@ -611,21 +632,6 @@ def import_users(self, request): self.message_user(request, "Operation failed.", messages.ERROR) return HttpResponseRedirect(reverse('admin:auth_user_changelist')) - def get_readonly_fields(self, request, obj=None): - """ - :inherit. - """ - if obj is not None and hasattr(obj, 'backend_user'): - return ['groups', 'is_staff', 'username'] - else: - return ['is_staff'] - - def has_add_permission(self, request): - """ - :inherit. - """ - return False - # register the model admins with the site admin_site = CoreAdminSite(name='ipynbsrv')