Changes between Version 2 and Version 3 of Ticket #31093


Ignore:
Timestamp:
Dec 15, 2019, 8:31:47 AM (5 years ago)
Author:
James Pic
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #31093 – Description

    v2 v3  
    1212{{{
    1313    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):   
    1515            return False
    1616   
    1717        return (   
    1818            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()   
    2020        )
    2121}}}
     
    2626{{{
    2727    def filter_queryset(self, user_obj, perm, queryset=None):
    28         if not queryset.model == MRSRequest:
     28        if not queryset.model == SomeModel:
    2929            return queryset
    3030
     
    3232            return queryset.none()   
    3333   
    34         return queryset.filter(caisse__in=user_obj.caisses.all())
     34        return queryset.filter(related_model_fk__in=user_obj.related_model_m2m.all())
    3535}}}
    3636
Back to Top