Skip to content

Commit

Permalink
Fix: buildings can't be created in the admin UI (#445)
Browse files Browse the repository at this point in the history
* Fix: buildings can't be created in the admin UI

* Makemigrations

* Formatting
  • Loading branch information
Andrew-Dickinson authored Aug 6, 2024
1 parent 8035b9b commit b6c2415
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/meshapi/migrations/0012_alter_building_nodes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.2.13 on 2024-08-01 22:36

from django.db import migrations

import meshapi.models.util.custom_many_to_many


class Migration(migrations.Migration):
dependencies = [
("meshapi", "0011_los"),
]

operations = [
migrations.AlterField(
model_name="building",
name="nodes",
field=meshapi.models.util.custom_many_to_many.CustomColumnNameManyToManyField(
blank=True,
db_from_column_name="building_id",
db_to_column_name="network_number",
help_text="All nodes located on the same structure (i.e. a discrete man-made place identified by the same BIN) that this Building is located within.",
related_name="buildings",
to="meshapi.node",
),
),
]
1 change: 1 addition & 0 deletions src/meshapi/models/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class Building(models.Model):
help_text="All nodes located on the same structure (i.e. a discrete man-made place identified by the same BIN) "
"that this Building is located within.",
related_name="buildings",
blank=True,
)

def save(self, *args: Any, **kwargs: Any) -> None:
Expand Down

0 comments on commit b6c2415

Please sign in to comment.