0.3.0 contacts page

This commit is contained in:
SDE
2023-12-09 20:13:32 +03:00
parent bc69d92ef7
commit aae426cf93
5 changed files with 295 additions and 3 deletions

View File

@@ -223,3 +223,72 @@ class Admin_Option(Admin_Trans_BaseModel):
list_filter = ['opt_type']
admin.site.register(Option,Admin_Option)
class AdminTabular_ContactModel(Admin_Trans_BaseIconTabularInline):
fields = [
'name', 'contact_type', 'contact_label', 'contact_prefix', 'contact_data', 'order'
]
model = Contact
extra = 1
ordering = ['order','contact_type', 'contact_label']
class Admin_Office(Admin_Trans_BaseModelViewPage):
fieldsets = [
(None, {
'classes': ['wide'],
'fields': (
# 'main_office',
'city',
'address',
(
'work_time_from', 'work_time_to',
# 'workTime',
),
# ('legal_name', 'unp', 'legal_address', 'urInfo'),
# 'fullContactInfo',
# 'footer_info',
# 'gps_longitude',
# 'gps_latitude',
# 'map_code'
)
}),
]
save_on_top = True
# prepopulated_fields = {"url": ("name",)}
list_display = [
'id', 'enable', 'order', 'city', 'address', 'work_time_from', 'work_time_to',
# 'main_office',
'modifiedDT', 'createDT'
]
list_editable = [
'work_time_from', 'work_time_to',
# 'main_office',
'order'
]
list_display_links = ['id', 'city', 'address']
search_fields = ['city', 'address', 'id']
list_filter = [
'enable',
# 'main_office',
'modifiedDT', 'createDT'
]
inlines = [AdminTabular_ContactModel]
# def has_delete_permission(self, request, obj=None):
# return not Office.objects.all().count() < 2
admin.site.register(Office, Admin_Office)