13 lines
444 B
Python
13 lines
444 B
Python
from django.contrib import admin
|
|
from django.http import HttpResponseRedirect
|
|
from .models import User
|
|
|
|
|
|
@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) |