I have a model Order
and model Invoice
. The Order
has
invoice = models.OneToOneField('Invoice', related_name='order', on_delete=models.CASCADE, blank=True, null=True)
Invoice object is created right after order object is created an assigned to it. Admin has to edit the invoice (price field) before customer pays.
The problem is that Django-admin
allows admin to change this field too (bottom of the image), which I can't risk but I want to let the pencil icon (change attributes of the invoice).
Is it possible to do that? When I add invoice
to readonly_fields
in OrderAdmin
, Admin can't edit those attributes like invoice.price etc.
EDIT:
So I want admin to be able to edit attributes of the invoice. Not add nor choose from dropdown.