fix configs
This commit is contained in:
parent
f9c5bdceee
commit
6d2aee572a
|
|
@ -80,22 +80,19 @@ class RegionQuerySet(models.QuerySet):
|
||||||
|
|
||||||
def without_parent_region(self, switcher: bool = True):
|
def without_parent_region(self, switcher: bool = True):
|
||||||
"""Filter regions by parent region."""
|
"""Filter regions by parent region."""
|
||||||
return self.filter(parent_region__isnull=switcher)\
|
return self.filter(parent_region__isnull=switcher)
|
||||||
.order_by('code')
|
|
||||||
|
|
||||||
def by_region_id(self, region_id):
|
def by_region_id(self, region_id):
|
||||||
"""Filter regions by region id."""
|
"""Filter regions by region id."""
|
||||||
return self.filter(id=region_id)\
|
return self.filter(id=region_id)
|
||||||
.order_by('code')
|
|
||||||
|
|
||||||
def by_sub_region_id(self, sub_region_id):
|
def by_sub_region_id(self, sub_region_id):
|
||||||
"""Filter sub regions by sub region id."""
|
"""Filter sub regions by sub region id."""
|
||||||
return self.filter(parent_region_id=sub_region_id)\
|
return self.filter(parent_region_id=sub_region_id)
|
||||||
.order_by('code')
|
|
||||||
|
|
||||||
def sub_regions_by_region_id(self, region_id):
|
def sub_regions_by_region_id(self, region_id):
|
||||||
"""Filter regions by sub region id."""
|
"""Filter regions by sub region id."""
|
||||||
return self.filter(parent_region_id=region_id).order_by('code')
|
return self.filter(parent_region_id=region_id)
|
||||||
|
|
||||||
|
|
||||||
class Region(models.Model):
|
class Region(models.Model):
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class CountryViewMixin(generics.GenericAPIView):
|
||||||
class RegionViewMixin(generics.GenericAPIView):
|
class RegionViewMixin(generics.GenericAPIView):
|
||||||
"""View Mixin for model Region"""
|
"""View Mixin for model Region"""
|
||||||
model = models.Region
|
model = models.Region
|
||||||
queryset = models.Region.objects.all()
|
queryset = models.Region.objects.all().order_by('name')
|
||||||
|
|
||||||
|
|
||||||
class CityViewMixin(generics.GenericAPIView):
|
class CityViewMixin(generics.GenericAPIView):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user