filter all apis of organization city & province - cant remove own user or organoization
This commit is contained in:
@@ -12,16 +12,16 @@ class RegionFilterMixin:
|
||||
|
||||
def filter_by_region(self, queryset, org: bool = None) -> typing.Any:
|
||||
request = self.request # noqa
|
||||
city_id = int(request.query_params.get('city_id'))
|
||||
province_id = int(request.query_params.get('province_id'))
|
||||
city_id = request.query_params.get('city_id')
|
||||
province_id = request.query_params.get('province_id')
|
||||
organization = get_organization_by_user(self.request.user) # noqa
|
||||
|
||||
if city_id:
|
||||
queryset = queryset.filter(city_id=city_id)
|
||||
queryset = queryset.filter(city_id=id(city_id))
|
||||
|
||||
elif province_id:
|
||||
if hasattr(queryset.model, 'province_id'):
|
||||
queryset = queryset.filter(province_id=province_id)
|
||||
queryset = queryset.filter(province_id=id(province_id))
|
||||
|
||||
# filter by organization type region
|
||||
if org:
|
||||
|
||||
Reference in New Issue
Block a user