Пример #1
0
    def __init__(self, *args, **kwargs):
        role_id = kwargs.pop(ROLE_ID, None)
        super(PersonDetachForm, self).__init__(*args, **kwargs)

        if role_id:
            self.fields[ROLE_ID].initial = role_id
            persons = RoleService.get_persons(id=role_id)
            self.fields[PERSONS].queryset = persons
        self.fields[PERSONS].empty_label = None
Пример #2
0
 def get_queryset(self):
     try:
         return RoleService.get_persons(id=self.get_obj_id())
     except:
         raise Http404