Reputation: 210633
How do you avoid duplicating validation code on the server-side and on the client-side with Django?
Given that Django follows a Don't Repeat Yourself principle, it seems logical that there would be a way to do this, but I have no idea how.
Upvotes: 4
Views: 1049
Reputation: 30522
Here's an uncompleted ("alpha grade") project that addresses your problem: http://eikke.com/django-validation-an-introduction/ :
So I’ve been thinking since some time to create a Django templatetag which allows one to generate client-side Javascript form validation code without writing any code himself (unless using custom widgets).... The resulting project is called django-validation.
(And see also Django ticket #19)
Upvotes: 3