Moved roll some context to bus object
Added first_name to traveller ordering
This commit is contained in:
@@ -59,7 +59,7 @@ def bus_roll_context(queryset=None):
|
||||
})
|
||||
shuttle_count += 1
|
||||
|
||||
bus_routes.append({'route_name': bus.route_name, 'company': bus.company, 'traveller_count': traveller_count, 'seating_capacity': bus.seating_capacity, 'route_stops': route_stops, 'shuttle_count': shuttle_count, 'shuttle_travellers': shuttle_travellers})
|
||||
bus_routes.append({'bus': bus, 'traveller_count': traveller_count, 'route_stops': route_stops, 'shuttle_count': shuttle_count, 'shuttle_travellers': shuttle_travellers})
|
||||
return {'routes': bus_routes}
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ def email_companies_bus_roll(request, query_set=None):
|
||||
company_route = []
|
||||
|
||||
for route in context.get("routes"):
|
||||
if route.get("company") == company:
|
||||
if route.get("bus").company == company:
|
||||
company_route.append(route)
|
||||
if not company_route:
|
||||
continue
|
||||
|
||||
@@ -241,7 +241,7 @@ class Traveller(models.Model):
|
||||
shuttle = models.ForeignKey(Shuttle, on_delete=models.SET_NULL, blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
ordering = ["last_name"]
|
||||
ordering = ["last_name", "first_name"]
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.first_name} {self.last_name}"
|
||||
|
||||
@@ -18,15 +18,15 @@
|
||||
</style>
|
||||
|
||||
{% for route in routes %}
|
||||
<h1 style="font-size: 2.5em">{{ route.route_name }}</h1>
|
||||
<h1 style="font-size: 2.5em">{{ route.bus.route_name }}</h1>
|
||||
<p style="text-align:right; font-size:12px">
|
||||
Total Travellers: {{ route.traveller_count }}<br>
|
||||
Seating Capacity: {{ route.seating_capacity }}
|
||||
Seating Capacity: {{ route.bus.seating_capacity }}
|
||||
</p>
|
||||
{% for stop in route.route_stops %}
|
||||
{% if stop.page_break %}
|
||||
<div style="page-break-before: always"></div>
|
||||
<h1 style="font-size: 2.5em">{{ route.route_name }}</h1>
|
||||
<h1 style="font-size: 2.5em">{{ route.bus.route_name }}</h1>
|
||||
{% endif %}
|
||||
<table class="stopHeader">
|
||||
<tr>
|
||||
@@ -79,7 +79,7 @@
|
||||
<h1 style="font-size: 2.5em">{{ route.route_name }} (Shuttle)</h1>
|
||||
<p style="text-align:right; font-size:12px">
|
||||
Total Travellers: {{ route.shuttle_count }}<br>
|
||||
Seating Capacity: {{ route.seating_capacity }}
|
||||
Seating Capacity: {{ route.bus.seating_capacity }}
|
||||
</p>
|
||||
<table class="traveller">
|
||||
{% for traveller in route.shuttle_travellers %}
|
||||
|
||||
Reference in New Issue
Block a user