Skip to content

Instantly share code, notes, and snippets.

@chrisjakuta
Created July 25, 2021 01:25
Show Gist options
  • Save chrisjakuta/4327d4a7dea018fd905f823fdb7439a7 to your computer and use it in GitHub Desktop.
Save chrisjakuta/4327d4a7dea018fd905f823fdb7439a7 to your computer and use it in GitHub Desktop.
Overriding the base admin template.
class EngineeringAdmin(AdminSite):
site_header = "Circulation Engineering Admin"
def get_urls(self):
urls = super().get_urls()
uda_gps_events_urls = [
url(
r'uda_gps_events/',
self.admin_view(
self.uda_gps_events_view
),
name='uda_gps_events_view',
)
]
return urls + uda_gps_events_urls
def uda_gps_events_view(self, request, **kwargs):
if request.GET:
print(request.GET.get('uber_details_actual_id'))
id = request.GET.get('uber_details_actual_id')
error = ''
if id is None:
error = 'no UDA specified'
gps_coords = GPSRideCoordinate.query(id)
if gps_coords:
if gps_coords._first_iteration:
gps_coords.next()
if not gps_coords._first_iteration:
gps_coords = gps_coords._items
return render(request, 'admin/udagpsevents.html', {'gps_coords': gps_coords})
error = 'Data for this query seems to be mangled 😕'
return render(request, 'admin/udagpsevents.html', {'error': error})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment