summaryrefslogtreecommitdiff
path: root/ishtar_common/admin.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2020-10-07 19:09:30 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:21 +0100
commit9d5f0791187ff6b18d3ffa4db4d593fe96834e8d (patch)
tree9cd21bf7e51d271b958a9a4b2b85367adbb97992 /ishtar_common/admin.py
parente5c0a159929fc64d63db37ebd85a5a810faf2534 (diff)
downloadIshtar-9d5f0791187ff6b18d3ffa4db4d593fe96834e8d.tar.bz2
Ishtar-9d5f0791187ff6b18d3ffa4db4d593fe96834e8d.zip
Refactoring of models. Document container - declare only id
Diffstat (limited to 'ishtar_common/admin.py')
-rw-r--r--ishtar_common/admin.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/ishtar_common/admin.py b/ishtar_common/admin.py
index 287f28249..b5ff67567 100644
--- a/ishtar_common/admin.py
+++ b/ishtar_common/admin.py
@@ -62,7 +62,7 @@ from django.views.decorators.csrf import csrf_protect
from django import forms
-from ishtar_common import models
+from ishtar_common import models, models_common
from ishtar_common.apps import admin_site
from ishtar_common.model_merging import merge_model_objects
from ishtar_common.utils import get_cache, create_slug
@@ -376,10 +376,10 @@ admin_site.register(models.IshtarSiteProfile, IshtarSiteProfileAdmin)
class DepartmentAdmin(admin.ModelAdmin):
list_display = ('number', 'label',)
- model = models.Department
+ model = models_common.Department
-admin_site.register(models.Department, DepartmentAdmin)
+admin_site.register(models_common.Department, DepartmentAdmin)
class OrganizationAdmin(HistorizedObjectAdmin):
@@ -765,7 +765,7 @@ class ImportGEOJSONActionAdmin(object):
continue
num_insee = values.pop('numero_insee')
year = values.pop('year') or None
- t, c = models.Town.objects.get_or_create(
+ t, c = models_common.Town.objects.get_or_create(
numero_insee=num_insee, year=year,
defaults=values)
if c:
@@ -861,7 +861,7 @@ class ImportJSONActionAdmin(admin.ModelAdmin):
class AdminRelatedTownForm(forms.ModelForm):
class Meta:
- model = models.Town.children.through
+ model = models_common.Town.children.through
exclude = []
from_town = AutoCompleteSelectField(
'town', required=True, label=_(u"Parent"))
@@ -869,7 +869,7 @@ class AdminRelatedTownForm(forms.ModelForm):
class AdminTownForm(forms.ModelForm):
class Meta:
- model = models.Town
+ model = models_common.Town
exclude = ['imports', 'departement']
center = PointField(label=_(u"Center"), required=False,
widget=OSMWidget)
@@ -880,7 +880,7 @@ class AdminTownForm(forms.ModelForm):
class TownParentInline(admin.TabularInline):
- model = models.Town.children.through
+ model = models_common.Town.children.through
fk_name = 'to_town'
form = AdminRelatedTownForm
verbose_name = _(u"Parent")
@@ -891,7 +891,7 @@ class TownParentInline(admin.TabularInline):
class TownAdmin(ImportGEOJSONActionAdmin, ImportActionAdmin):
change_list_template = "admin/town_change_list.html"
- model = models.Town
+ model = models_common.Town
list_display = ['name', 'year']
search_fields = ['name']
readonly_fields = ['cached_label']
@@ -907,7 +907,7 @@ class TownAdmin(ImportGEOJSONActionAdmin, ImportActionAdmin):
import_keys = ['slug', 'txt_idx', 'numero_insee']
-admin_site.register(models.Town, TownAdmin)
+admin_site.register(models_common.Town, TownAdmin)
class GeneralTypeAdmin(ImportActionAdmin, ImportJSONActionAdmin):