Features: 1) Add new fields (city, region, postal_code, country, location, raw_data, api_response, user) to the Address model via migration 0004; 2) Introduce user ForeignKey to link Address model with AUTH_USER_MODEL.
Fixes: 1) Correct PointField import in migration 0001 to resolve GIS model inconsistency. Extra: Adjust formatting in migration files for consistency.
This commit is contained in:
parent
7b7a518050
commit
28ac65332c
2 changed files with 60 additions and 3 deletions
|
|
@ -38,9 +38,9 @@ class Migration(migrations.Migration):
|
|||
('region', models.CharField(max_length=100, null=True, verbose_name='region')),
|
||||
('postal_code', models.CharField(max_length=20, null=True, verbose_name='postal code')),
|
||||
('country', models.CharField(max_length=40, null=True, verbose_name='country')),
|
||||
('location', django.contrib.gis.db.models.fields.PointField(blank=True, geography=True,
|
||||
help_text='Geolocation point: (longitude, latitude)',
|
||||
null=True, srid=4326)),
|
||||
('location', django.contrib.gis.db.models.PointField(blank=True, geography=True,
|
||||
help_text='Geolocation point: (longitude, latitude)',
|
||||
null=True, srid=4326)),
|
||||
('raw_data', models.JSONField(blank=True, help_text='Full JSON response from geocoder for this address',
|
||||
null=True)),
|
||||
('api_response',
|
||||
|
|
|
|||
57
geo/migrations/0004_add_missing_fields.py
Normal file
57
geo/migrations/0004_add_missing_fields.py
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import django.contrib.gis.db.models.fields
|
||||
from django.conf import settings
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('geo', '0003_add_district_field'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='address',
|
||||
name='city',
|
||||
field=models.CharField(max_length=255, null=True, verbose_name='city'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='address',
|
||||
name='region',
|
||||
field=models.CharField(max_length=255, null=True, verbose_name='region'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='address',
|
||||
name='postal_code',
|
||||
field=models.CharField(max_length=255, null=True, verbose_name='postal_code'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='address',
|
||||
name='country',
|
||||
field=models.CharField(max_length=255, null=True, verbose_name='country'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='address',
|
||||
name='location',
|
||||
field=django.contrib.gis.db.models.PointField(blank=True, geography=True,
|
||||
help_text='Geolocation point: (longitude, latitude)',
|
||||
null=True, srid=4326),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='address',
|
||||
name='raw_data',
|
||||
field=models.JSONField(blank=True, help_text='Full JSON response from geocoder for this address',
|
||||
null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='address',
|
||||
name='api_response',
|
||||
field=models.JSONField(blank=True, help_text='Stored JSON response from the geocoding service', null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='address',
|
||||
name='user',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE,
|
||||
to=settings.AUTH_USER_MODEL),
|
||||
),
|
||||
]
|
||||
Loading…
Reference in a new issue