aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/organisations
diff options
context:
space:
mode:
Diffstat (limited to 'ctrack/organisations')
-rw-r--r--ctrack/organisations/admin.py11
-rw-r--r--ctrack/organisations/tests/test_models.py7
2 files changed, 11 insertions, 7 deletions
diff --git a/ctrack/organisations/admin.py b/ctrack/organisations/admin.py
index 1f36699..ecf67dd 100644
--- a/ctrack/organisations/admin.py
+++ b/ctrack/organisations/admin.py
@@ -3,19 +3,18 @@ from django.contrib import admin
from .models import Organisation, Address, AddressType
-class OrganisationAdmin(admin.ModelAdmin):
+class AddressTypeAdmin(admin.ModelAdmin):
pass
-class AddressTypeAdmin(admin.ModelAdmin):
- pass
+class AddressInLine(admin.StackedInline):
+ model = Address
-class AddressAdmin(admin.ModelAdmin):
- pass
+class OrganisationAdmin(admin.ModelAdmin):
+ inlines = [AddressInLine,]
# Register your models here.
admin.site.register(Organisation, OrganisationAdmin)
admin.site.register(AddressType, AddressTypeAdmin)
-admin.site.register(Address, AddressAdmin)
diff --git a/ctrack/organisations/tests/test_models.py b/ctrack/organisations/tests/test_models.py
index 946fda5..cb3b9af 100644
--- a/ctrack/organisations/tests/test_models.py
+++ b/ctrack/organisations/tests/test_models.py
@@ -1,7 +1,7 @@
import pytest
from slugify import slugify
-from ..models import Organisation
+from ..models import Organisation, Address
pytestmark = pytest.mark.django_db
@@ -30,3 +30,8 @@ def test_update_organisation(org: Organisation):
org.name = "Tonkers Ltd"
org.save()
assert org.name == "Tonkers Ltd"
+
+
+def test_new_address(addr: Address):
+ # The address "has" an organisation
+ assert addr.organisation.name