Added clone model (WIP)
This commit is contained in:
@@ -133,6 +133,5 @@ GitHub.sublime-settings
|
||||
/static
|
||||
/busManager/busManager/settings.py
|
||||
/busManager/coord/migrations
|
||||
/busManager/coord/adminClone.py
|
||||
/busManager/coord/adminCloneOld.py
|
||||
/busManager/busManager/templates/admin/base.html
|
||||
@@ -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 = [
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
{% load i18n admin_urls %}
|
||||
|
||||
{% block object-tools-items %}
|
||||
<li><a href="clone/" class="addlink">{{ clone_verbose_name }}</a></li>
|
||||
<li><a href="{{ clone_link }}" class="addlink">{{ clone_verbose_name }}</a></li>
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
||||
@@ -5,6 +5,5 @@ from . import views
|
||||
urlpatterns = [
|
||||
path("", views.bus_numbers, name="index"),
|
||||
path("roll", views.bus_roll, name="Student Roll"),
|
||||
path("clone", views.clone, name="Clone"),
|
||||
path("contacts", views.emergency_contacts, name="Emergency Contacts")
|
||||
]
|
||||
|
||||
@@ -94,15 +94,6 @@ def emergency_contacts(request, queryset=None):
|
||||
return render(request, 'reports/emergency_contacts.html', {'routes': bus_routes})
|
||||
|
||||
|
||||
@staff_member_required
|
||||
def clone(request):
|
||||
options = {
|
||||
'verbose_name': "Traveller",
|
||||
'app_label': "coord"
|
||||
}
|
||||
return render(request, 'admin/clone_form.html', options)
|
||||
|
||||
|
||||
@staff_member_required
|
||||
class CompanyList(ListView):
|
||||
model = Company
|
||||
|
||||
Reference in New Issue
Block a user