On 2011-06-13, at 13:36 , Kenneth Gonsalves wrote: > The app does not use forms. The forms are in js and ajax is used to send > the data to and from the views. The data is not validated on the server > side and all save() statements are enclosed in try-except blocks. Are you sure it's not using model validation either?
> The db > is mysql. This does not look like a good practice to me - surely one can > use django forms with ajax? Opinions? Sure, even if the form controls are created dynamically in javascript, you can still use django forms for structured validation and conversion (though depending on the way the ajax calls are structured, you may already be receiving typed data if communications are in e.g. json-rpc). But as I noted above, in 1.2 or later you could use models validation[0]. You should check that it's not what's being done already, if the try/except blocks catch ValidationError it's possible you predecessor used that. Django provides a bunch of built-in validators[1] and new validators are easy to write, and if you're not using form serialization (because the form UI is built in JS on the client), it can make more sense than using separate forms (which would add little to no value, especially if the validation is not overly complex). [0] https://docs.djangoproject.com/en/1.3/ref/models/instances/#validating-objects [1] https://docs.djangoproject.com/en/1.3/ref/validators/ -- 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.