Admin form validation

I have a parent Invoice model (SupplierInvoice) that contains multiple orders (SupplierOrder). Right now, if a user summarizes an invoice via django admin, django checks if there is a price comparison for that Supplier and Product in the cost table and pulls through the appropriate fields. This process is done using a special save method.

What I need to add is code for all cases where there is no price negotiation, in which case the check should start and warn the user that they have to put something in order before committing.

I've tried several custom modelForm "clean" methods, and they run before the save method has a chance to look at prices and check first.

Ideally, I want Django to check the corresponding tables for price matches. THEN confirm there is no match and you need to enter.

http://dpaste.com/hold/47848/ for the relevant code.

Thanks for any help - I'm completely stumped!

0


a source to share


1 answer


Well yes, there will be a cleanup before saving to make sure the form is valid before saving it. Therefore, you will need to look for prices in their pure form.



+1


a source







All Articles