Changes between Version 2 and Version 3 of Ticket #31093
- Timestamp:
- Dec 15, 2019, 8:31:47 AM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #31093 – Description
v2 v3 12 12 {{{ 13 13 def has_perm(self, user_obj, perm, obj=None): 14 if not user_obj.is_authenticated or not isinstance(obj, MRSRequest):14 if not user_obj.is_authenticated or not isinstance(obj, SomeModel): 15 15 return False 16 16 17 17 return ( 18 18 user_obj.profile == 'admin' 19 or obj. caisse in user_obj.caisses.all()19 or obj.related_model_fk in user_obj.related_model_m2m.all() 20 20 ) 21 21 }}} … … 26 26 {{{ 27 27 def filter_queryset(self, user_obj, perm, queryset=None): 28 if not queryset.model == MRSRequest:28 if not queryset.model == SomeModel: 29 29 return queryset 30 30 … … 32 32 return queryset.none() 33 33 34 return queryset.filter( caisse__in=user_obj.caisses.all())34 return queryset.filter(related_model_fk__in=user_obj.related_model_m2m.all()) 35 35 }}} 36 36