forked from rapidpro/rapidpro
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add location model and location field to org
- Loading branch information
Showing
6 changed files
with
172 additions
and
12 deletions.
There are no files selected for viewing
108 changes: 108 additions & 0 deletions
108
...a/locations/migrations/0033_location_locationalias_location_locations_by_name_and_more.py
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,108 @@ | ||
# Generated by Django 5.1.4 on 2025-01-10 10:06 | ||
|
||
import mptt.fields | ||
|
||
import django.db.models.deletion | ||
import django.db.models.functions.text | ||
import django.utils.timezone | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("locations", "0032_squashed"), | ||
("orgs", "0164_remove_viewers"), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Location", | ||
fields=[ | ||
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
("osm_id", models.CharField(max_length=15, unique=True)), | ||
("name", models.CharField(max_length=128)), | ||
("level", models.IntegerField()), | ||
("path", models.CharField(max_length=768)), | ||
("geometry", models.JSONField(null=True)), | ||
("lft", models.PositiveIntegerField(editable=False)), | ||
("rght", models.PositiveIntegerField(editable=False)), | ||
("tree_id", models.PositiveIntegerField(db_index=True, editable=False)), | ||
( | ||
"parent", | ||
mptt.fields.TreeForeignKey( | ||
null=True, | ||
on_delete=django.db.models.deletion.PROTECT, | ||
related_name="children", | ||
to="locations.location", | ||
), | ||
), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name="LocationAlias", | ||
fields=[ | ||
("id", models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
( | ||
"is_active", | ||
models.BooleanField( | ||
default=True, help_text="Whether this item is active, use this instead of deleting" | ||
), | ||
), | ||
( | ||
"created_on", | ||
models.DateTimeField( | ||
blank=True, | ||
default=django.utils.timezone.now, | ||
editable=False, | ||
help_text="When this item was originally created", | ||
), | ||
), | ||
( | ||
"modified_on", | ||
models.DateTimeField( | ||
blank=True, | ||
default=django.utils.timezone.now, | ||
editable=False, | ||
help_text="When this item was last modified", | ||
), | ||
), | ||
("name", models.CharField(help_text="The name for our alias", max_length=128)), | ||
( | ||
"created_by", | ||
models.ForeignKey( | ||
help_text="The user which originally created this item", | ||
on_delete=django.db.models.deletion.PROTECT, | ||
related_name="%(app_label)s_%(class)s_creations", | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
( | ||
"location", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.PROTECT, related_name="aliases", to="locations.location" | ||
), | ||
), | ||
( | ||
"modified_by", | ||
models.ForeignKey( | ||
help_text="The user which last modified this item", | ||
on_delete=django.db.models.deletion.PROTECT, | ||
related_name="%(app_label)s_%(class)s_modifications", | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
("org", models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to="orgs.org")), | ||
], | ||
), | ||
migrations.AddIndex( | ||
model_name="location", | ||
index=models.Index(django.db.models.functions.text.Lower("name"), name="locations_by_name"), | ||
), | ||
migrations.AddIndex( | ||
model_name="locationalias", | ||
index=models.Index(django.db.models.functions.text.Lower("name"), name="locationaliases_by_name"), | ||
), | ||
] |
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,20 @@ | ||
# Generated by Django 5.1.4 on 2025-01-10 10:06 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("locations", "0033_location_locationalias_location_locations_by_name_and_more"), | ||
("orgs", "0164_remove_viewers"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="org", | ||
name="location", | ||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to="locations.location"), | ||
), | ||
] |
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 was deleted.
Oops, something went wrong.