1. Waldemar Kornewald
  2. djangotoolbox

Commits

d3f3nd3r  committed 08daa77

fix layout stuff

  • Participants
  • Parent commits 5636d15
  • Branches default

Comments (0)

Files changed (2)

File djangotoolbox/admin.py

View file
 from django.contrib.auth.admin import UserAdmin
 from django.contrib.auth.models import User, Group, Permission
 
-from djangotoolbox.auth.utils import update_permissions_user,\
+from djangotoolbox.auth.utils import update_permissions_user, \
      update_user_groups, update_permissions_group
 from djangotoolbox.auth.models import UserPermissionList, GroupList, \
      GroupPermissionList
         self.fields['groups'].choices = choices
 
         try:
-            user_perm_list = UserPermissionList.objects.get(user=kwargs['instance'])
+            user_perm_list = UserPermissionList.objects.get(
+                user=kwargs['instance'])
             self.fields['permissions'].initial = user_perm_list.fk_list
         except (UserPermissionList.DoesNotExist, KeyError):
             self.fields['permissions'].initial = list()
             
         try:
-            user_group_list = GroupList.objects.get(user=kwargs['instance'])
+            user_group_list = GroupList.objects.get(
+                user=kwargs['instance'])
             self.fields['groups'].initial = user_group_list.fk_list
         except (GroupList.DoesNotExist, KeyError):
             self.fields['groups'].initial = list()
         super(CustomUserAdmin, self).save_model(request, obj, form, change)
 
         if len(form.cleaned_data['permissions']) > 0:
-            permissions = list(Permission.objects.filter(id__in=form.cleaned_data['permissions']).order_by('name'))
+            permissions = list(Permission.objects.filter(
+                id__in=form.cleaned_data['permissions']).order_by('name'))
         else:
             permissions = list()
             
         update_permissions_user(permissions, obj)
 
         if len(form.cleaned_data['groups']) > 0:
-            groups = list(Group.objects.filter(id__in=form.cleaned_data['groups']))
+            groups = list(Group.objects.filter(
+                id__in=form.cleaned_data['groups']))
         else:
             groups = list()
 
         self.fields['permissions'].choices = choices
 
         try:
-            current_perm_list = GroupPermissionList.objects.get(group=kwargs['instance'])
+            current_perm_list = GroupPermissionList.objects.get(
+                group=kwargs['instance'])
             self.fields['permissions'].initial = current_perm_list.fk_list
         except (GroupPermissionList.DoesNotExist, KeyError):
             self.fields['permissions'].initial = list()
         super(CustomGroupAdmin, self).save_model(request, obj, form, change)
 
         if len(form.cleaned_data['permissions']) > 0:
-            permissions = list(Permission.objects.filter(id__in=form.cleaned_data['permissions']).order_by('name'))
+            permissions = list(Permission.objects.filter(
+                id__in=form.cleaned_data['permissions']).order_by('name'))
         else:
             permissions = list()
             

File djangotoolbox/auth/backends.py

View file
-try:
-    set
-except NameError:
-    from sets import Set as set # Python 2.3 fallback
-
 from django.contrib.auth.backends import ModelBackend
 from django.contrib.auth.models import User