14 lines
505 B
Python
14 lines
505 B
Python
from django.contrib import admin
|
|
from django.http import HttpResponseRedirect
|
|
from .models import User, Profile, Racer
|
|
|
|
admin.register(Profile)
|
|
admin.register(Racer)
|
|
@admin.register(User)
|
|
class UserAdmin(admin.ModelAdmin):
|
|
change_form_template = "invoice_custom_admin_page.html"
|
|
|
|
def response_change(self, request, obj):
|
|
if "_invoice" in request.POST:
|
|
return HttpResponseRedirect(f"/api/invoice?invoice_id={obj.invoice_id}")
|
|
return super().response_change(request, obj) |