Skip to content

Commit

Permalink
Add existing buildings to node through new Inline
Browse files Browse the repository at this point in the history
  • Loading branch information
WillNilges committed Apr 26, 2024
1 parent 71c6547 commit d50c93d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/meshapi/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ class Media:
}


class MembershipInline(admin.TabularInline):
model = Building.nodes.through
extra = 0
autocomplete_fields = ["building_id"]

class NonrelatedBuildingInline(BetterNonrelatedInline):
model = Building
fields = ["primary_node", "bin", "street_address", "city", "zip_code"]
Expand Down Expand Up @@ -506,7 +511,7 @@ class NodeAdmin(admin.ModelAdmin):
},
),
]
inlines = [InstallInline, NonrelatedBuildingInline, DeviceInline, SectorInline, NodeLinkInline]
inlines = [InstallInline, MembershipInline, NonrelatedBuildingInline, DeviceInline, SectorInline, NodeLinkInline]

def address(self, obj):
return obj.buildings.first()
Expand Down

0 comments on commit d50c93d

Please sign in to comment.