Skip to content

Commit

Permalink
Add location field to Org
Browse files Browse the repository at this point in the history
  • Loading branch information
norkans7 committed Jan 9, 2025
1 parent 382e2e2 commit c735b2b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
3 changes: 0 additions & 3 deletions temba/locations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,6 @@ class Location(MPTTModel, models.Model):
objects = NoGeometryManager()
geometries = GeometryManager()

def __str__(self):
return self.name

class Meta:
indexes = [models.Index(Upper("name"), name="locations_by_name")]

Expand Down
20 changes: 20 additions & 0 deletions temba/orgs/migrations/0165_org_location.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 5.1.4 on 2025-01-09 09:39

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"),
),
]
1 change: 1 addition & 0 deletions temba/orgs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ class Org(SmartModel):
help_text=_("Default formatting and parsing of dates in flows and messages."),
)
country = models.ForeignKey("locations.AdminBoundary", null=True, on_delete=models.PROTECT)
location = models.ForeignKey("locations.Location", null=True, on_delete=models.PROTECT)
flow_languages = ArrayField(models.CharField(max_length=3), default=list, validators=[ArrayMinLengthValidator(1)])
input_collation = models.CharField(max_length=32, choices=COLLATION_CHOICES, default=COLLATION_DEFAULT)
flow_smtp = models.CharField(null=True) # e.g. smtp://...
Expand Down
10 changes: 0 additions & 10 deletions temba/orgs/tests/test_migrations.py

This file was deleted.

0 comments on commit c735b2b

Please sign in to comment.