Skip to content

Commit

Permalink
container image name can safely be changed; A-z ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
michelkaeser committed Aug 10, 2015
1 parent 2c312f8 commit ea60c83
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions ipynbsrv/admin/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 []


Expand Down Expand Up @@ -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
Expand All @@ -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')
Expand Down

0 comments on commit ea60c83

Please sign in to comment.