Added clone model (WIP)

This commit is contained in:
John Mullins
2023-08-25 10:27:11 +10:00
parent c312f8ea85
commit c07fd817a8
5 changed files with 10 additions and 13 deletions
+9 -1
View File
@@ -8,6 +8,7 @@ from django.utils.html import format_html
from django.utils.http import urlencode
from import_export.admin import ImportExportModelAdmin
from .adminClone import CloneModelAdmin
from .models import *
from .views import bus_roll
@@ -106,10 +107,17 @@ class TravellerRouteInline(admin.TabularInline):
@admin.register(Traveller)
class TravellerAdmin(MyImportExportModelAdmin, admin.ModelAdmin):
class TravellerAdmin(MyImportExportModelAdmin, CloneModelAdmin, admin.ModelAdmin):
list_display = ["first_name", "last_name", "school", "year_level", "residential_address", "residential_suburb"]
list_filter = ["school", "eligibility_status", "bus_stops__bus", "residential_suburb"]
search_fields = ["first_name", "last_name", "residential_address"]
cloneable_fields = ["last_name", "residential_address", "residential_suburb",
"postal_address", "postal_suburb", "eligibility_status", "shuttle",
"parent_A_firstname", "parent_A_lastname", "parent_A_phone", "parent_A_email",
"parent_B_firstname", "parent_B_lastname", "parent_B_phone", "parent_B_email",
"emergency_contact_A_firstname", "emergency_contact_A_lastname", "emergency_contact_A_phone",
"emergency_contact_A_relation", "emergency_contact_B_firstname", "emergency_contact_B_lastname",
"emergency_contact_B_phone", "emergency_contact_B_relation"]
inlines = [TravellerRouteInline]
readonly_fields = ["fare_paying"]
fieldsets = [