Code

Ticket #17254: backends.diff

File backends.diff, 1.4 KB (added by riccardodivirgilio, 3 years ago)
Line 
11c1
2< from django.contrib.auth.models import User, Permission
3---
4> from django.contrib.auth.models import User, Permission, AnonymousUser
58a9,15
6>     
7>     user_model = User
8>     permission_model = Permission
9>     anonymous_user_model = AnonymousUser
10>     
11>     def get_anonymous_user(self):
12>         return AnonymousUser()
1314c21
14<             user = User.objects.get(username=username)
15---
16>             user = self.user_model.objects.get(username=username)
1717c24
18<         except User.DoesNotExist:
19---
20>         except self.user_model.DoesNotExist:
2129c36
22<                 perms = Permission.objects.all()
23---
24>                 perms = self.permission_model.objects.all()
2531c38
26<                 perms = Permission.objects.filter(group__user=user_obj)
27---
28>                 perms = self.permission_model.objects.filter(group__user=user_obj)
2962,63c69,70
30<             return User.objects.get(pk=user_id)
31<         except User.DoesNotExist:
32---
33>             return self.user_model.objects.get(pk=user_id)
34>         except self.user_model.DoesNotExist:
35100c107
36<             user, created = User.objects.get_or_create(username=username)
37---
38>             user, created = self.user_model.objects.get_or_create(username=username)
39105,106c112,113
40<                 user = User.objects.get(username=username)
41<             except User.DoesNotExist:
42---
43>                 user = self.user_model.objects.get(username=username)
44>             except self.user_model.DoesNotExist: