Hi, If you don't need the form elements themselves, as you do everything in the save method, you don't need to do anything with the form. All you need to do, is to create the visual effect, which can be done with jQuery quite easily. You could just hide the fields if you prefer them empty and create some of your own fields to display then stuff in, or just use the form fields.
I would suggest a blur trigger that check if values on the needed fields have been filled. Then all you need to to, is to make a ajax get request where you send along the values. Create a view that handles the calc and sends the data back. You could also if you prefer do the calculation in javascript. But I don't see how this should break your setup. ~Jakob On 2 Apr., 09:59, Alfonso <allanhender...@gmail.com> wrote: > Hi, > > I've got two very unremarkable models, Invoice Order that has a > foreign key to an Invoice model. There are some tax calculations that > happen on the save of the order model that populate and update the > corresponding fields in the Invoice model. All works fine and in fact > all calculations in the system happen within a custom save function. > > So as far as the user is concerned they see a few fields that are > empty but populated when the form is saved. The client has requested > to see if we can improve that functionality and populate the necessary > fields as the user fills in the form, so once a price and tax rate are > added the final price field is populated also. Along with that the > form will be populated with the relevent prices when a user selects > the product to add to the order. complicated I think. > > My question centers around how I would implement such functionality, > it screams to me JQuery or similar doing it's magic to perform the > necessary calcs and then django reverts to a normal save function. > > Obviously that is a pretty big rewrite and I'd like to avoid making > things complicated and losing what coding I've done. > > Does anyone have any better suggestions for how I might accomplish > that sort of functionality fairly cleanly? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---