def queryset(self, request): query_set = super(CustomerInvoiceInline, self).queryset(request) display_paid = get_display_paid() paid_status = get_or_create_paid_invoice_status() if not display_paid: query_set = query_set.exclude(status__status=paid_status) return query_set
def change_view(self, *args, **kwargs): display_paid = get_display_paid() if not display_paid: inline_title = "Unpaid invoices" else: inline_title = "Invoices" kwargs["extra_context"] = {"inline_title": inline_title} return super(CustomerAdmin, self).change_view(*args, **kwargs)