[GSoC 2016]Proposal: Validity check at client and dynamic form framework

171 views
Skip to first unread message

Lover Di

unread,
Mar 20, 2016, 10:20:12 AM3/20/16
to Django developers (Contributions to Django itself)
Hi,

I have been working for preparing a proposal about a new feature for Django. I'm posting my draft proposal to Gist and want to know my idea is OK or not. So I can proceed with the right approach. Any suggestions or advice are welcome.

Abstract of my proposal:
  • Automatically generate some simple javascript code to check the validity for forms
  • Many dynamic forms use similar logic, they can be abstracted into a framework to help generated view code and javascript code, users only need to fill out the logic of "how to change". Thus, the workload of write dynamic form greatly reduced.


Regards,

7sDream

Cristiano Coelho

unread,
Mar 20, 2016, 2:23:16 PM3/20/16
to Django developers (Contributions to Django itself)
The client side validation is a very good idea, other frameworks such as ASP.NET MVC already has some basic client side validation tied to model fields (equivalent to django forms) and also provides a very easy way to add custom javascript validation and tie to the model/form.

For the second part about dynamic forms, it really looks complicated to implement, looks like a job for more than one person.

7sDream

unread,
Mar 20, 2016, 10:52:32 PM3/20/16
to Django developers (Contributions to Django itself)
Thanks for your advice! 

My first thought is the client side validation too. Because I used some Forms in my Django project, after write javascript for each form, I feel this is redundant.

Then I thought of another common demand of Form, the dynamic form. After I draw the chart, I also find it is a little complicated so I arranged for eight weeks to finish it. 

Do you think I should focus on client side validation (delete dynamic form part)? Or describe the complexity of dynamic form and give a more detailed schedule?

Thanks again!

在 2016年3月21日星期一 UTC+8上午2:23:16,Cristiano Coelho写道:

Cristiano Coelho

unread,
Mar 21, 2016, 8:23:54 AM3/21/16
to Django developers (Contributions to Django itself)
I don't have enough enough knowledge on how GSoC works and what the django team expects from people proposing projects but if it was me I would rather have a very well implemented, tested and with a good level of customization client side validation than two not so well features but that's up to the times used. I'm sure someone more related to this will be able to give you a better answer but the two ideas are definitely interesting :)

7sDream

unread,
Mar 21, 2016, 1:12:15 PM3/21/16
to Django developers (Contributions to Django itself)
En, it sounds very reasonable. Master of one is better than Jack of all trades. Maybe I can divide my proposal into two proposals. Fortunately, GSoC allowed to submit multiple proposals to the same organization.

Your help is awesome, thank you!

在 2016年3月21日星期一 UTC+8下午8:23:54,Cristiano Coelho写道:

Jani Tiainen

unread,
Mar 22, 2016, 8:23:39 AM3/22/16
to django-d...@googlegroups.com
Hi,

Your proposal does have few points that I would like to address so you could make your proposal more solid:

 - What changes are required in Django core/forms to make this work? By looking your current proposal it looks like something that can be done without any changes to Django core/forms. This is actually your "homework" that you have to do for proposal.

 - You propose that this could be "django.contrib" package.That gives a hint that this could be a 3rd party package. So it would be beneficial that you actually do some reference implementation for example for few fields to backup your proposal. If this requires some changes to core, you can point them out in your proposal much easier.

 - Django has a tradition to be agnostic from client side JS frameworks. Your proposition states that validation would use jQuery. What if I want to use something else like Dojotoolkit or ExtJS (which I do use, I don't use jQuery at all).

 - In your proposal Javascript is generated in a Python. It's generally considered already a bad thing that forms makes certain rendering designs HTML. Your proposal is to move more representation parts into Python side. Could some of it be moved to presentation layer (templates)?

--

Jani Tiainen

Tim Graham

unread,
Mar 22, 2016, 9:10:53 AM3/22/16
to Django developers (Contributions to Django itself)
I agree with Jani that you should think about trying to make the proposal accommodate different JavaScript frameworks. You might look at https://github.com/jrief/django-angular, for example, for inspiration.

Just thinking about what problems Django should be trying to solve, I'm wondering if client-side JavaScript validation might be obsoleted to some extent as browsers improve support for HTML5 validation?
Reply all
Reply to author
Forward
0 new messages