This repository has been archived by the owner on Aug 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Break PlanItLocation out from org model
- Add helper on PlanItUser model to get location - Fix tests with appropriate mock - Only update location info when created - Implement OrganizationSerializer create/update methods - Remove uniqueness constraint on location.api_city_id Removing the constraint was the lesser of two evils while we're interating quickly on the definition of this object. See: - encode/django-rest-framework#2996 - https://medium.com/django-rest-framework/dealing-with-unique-constraints-in-nested-serializers-dade33b831d9 Handling nested serializers with uniqueness constraints requires overriding the default validators generated for the entire serializer which is super inelegant. No harm to us for now if what are essentially duplicate planitlocation objects get created somehow.
- Loading branch information
CloudNiner
committed
Nov 16, 2017
1 parent
56acfcc
commit 73b8c5a
Showing
10 changed files
with
167 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.7 on 2017-11-14 14:32 | ||
from __future__ import unicode_literals | ||
|
||
import django.contrib.gis.db.models.fields | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('users', '0009_auto_20171108_2156'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='PlanItLocation', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(blank=True, max_length=256, null=True)), | ||
('api_city_id', models.IntegerField(null=True, unique=True)), | ||
('point', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326)), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.7 on 2017-11-14 14:38 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('users', '0010_planitlocation'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='planitorganization', | ||
name='api_city_id', | ||
), | ||
migrations.AddField( | ||
model_name='planitorganization', | ||
name='location', | ||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='users.PlanItLocation'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.7 on 2017-11-14 19:17 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('users', '0011_auto_20171114_1438'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='planitlocation', | ||
name='api_city_id', | ||
field=models.IntegerField(blank=True, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters