开发者

Django: Avoiding Server-Side and Client-Side Validation Code Duplication

开发者 https://www.devze.com 2023-03-18 06:56 出处:网络
How do you avoid duplicating validation code on the server开发者_如何学Go-side and on the client-side with Django?

How do you avoid duplicating validation code on the server开发者_如何学Go-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.


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消