add 2 new fields city & province in device - fix bug of filter_by_region
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
# Generated by Django 5.0 on 2025-10-27 10:38
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('authentication', '0038_organizationtype_region_scope'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='organizationtype',
|
||||
name='region_scope',
|
||||
),
|
||||
]
|
||||
@@ -26,7 +26,7 @@ class RegionFilterMixin:
|
||||
if hasattr(queryset.model, 'province_id'):
|
||||
queryset = queryset.filter(province_id=id(province_id))
|
||||
elif hasattr(queryset.model, 'user'):
|
||||
queryset = queryset.filter(user__province=organization.city)
|
||||
queryset = queryset.filter(user__province=id(province_id))
|
||||
|
||||
# filter by organization type region
|
||||
if org:
|
||||
@@ -42,7 +42,7 @@ class RegionFilterMixin:
|
||||
if hasattr(queryset.model, 'province_id'):
|
||||
queryset = queryset.filter(province=organization.province)
|
||||
elif hasattr(queryset.model, 'user'):
|
||||
queryset = queryset.filter(user__province=organization.city)
|
||||
queryset = queryset.filter(user__province=organization.province)
|
||||
|
||||
# if organization is admin of system
|
||||
elif scope == 'CO':
|
||||
|
||||
Reference in New Issue
Block a user