开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜