Skip to content

Commit beeaf00

Browse files
committed
Admin2 area can be deprecated
1 parent 89647c5 commit beeaf00

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 3.2.18 on 2023-04-12 17:55
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('api', '0162_admin2_created_at'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='admin2',
15+
name='is_deprecated',
16+
field=models.BooleanField(default=False, help_text='Is this a deprecated area?'),
17+
),
18+
]

api/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ class Admin2(models.Model):
273273
local_name_code = models.CharField(verbose_name=_('Local Name Language Code'), max_length=10, blank=True, null=True)
274274
alternate_name = models.CharField(verbose_name=_('Alternate Name'), max_length=100, blank=True, null=True)
275275
alternate_name_code = models.CharField(verbose_name=_('Alternate Name Language Code'), max_length=10, blank=True, null=True)
276+
is_deprecated = models.BooleanField(default=False, help_text=_('Is this a deprecated area?'))
276277
created_at = models.DateTimeField(verbose_name=_('Created at'), auto_now_add=True)
277278

278279
class Meta:

api/serializers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,14 @@ class Meta:
211211

212212

213213

214-
215214
class Admin2Serializer(GeoSerializerMixin, ModelSerializer):
216215
bbox = serializers.SerializerMethodField()
217216
centroid = serializers.SerializerMethodField()
218217
district_id = serializers.IntegerField(source='admin1.id', read_only=True)
219218

220219
class Meta:
221220
model = Admin2
222-
fields = ('district_id', 'name', 'code', 'bbox', 'centroid',)
221+
fields = ('district_id', 'name', 'code', 'bbox', 'centroid', 'is_deprecated',)
223222

224223

225224
class MiniDistrictSerializer(ModelSerializer):

0 commit comments

Comments
 (0)