Integration of Django-angular for client-side validations

Registered by Cristian A Sanchez

The framework django-angular provides mechanisms for enabling client-side validations using the same rules described in forms.py. With the integration of django-angular into Horizon, we will have just one way to describe validation rules, and these will be used both in client and backend. More information: http://django-angular.readthedocs.org/en/latest/angular-form-validation.html

Blueprint information

Status:
Complete
Approver:
David Lyle
Priority:
Medium
Drafter:
Cristian A Sanchez
Direction:
Approved
Assignee:
None
Definition:
Obsolete
Series goal:
None
Implementation:
Not started
Milestone target:
None
Completed by
David Lyle

Related branches

Sprints

Whiteboard

There are two ways to approach the solution:

Option 1
Use completely the implementation proposed in the django-angular documentation
            http://django-angular.readthedocs.org/en/latest/angular-form-validation.html
Modal form template should be modified to include {{ form }} to render the form without iterating each field because django-angular based form is responsible for rendering the fields and the required tags for properly displaying the errors inside angularjs.
One caveat is that by using this approach, we cannot customize the layout of the error messages, because they are hardcoded as <li> tags in django-angular. They can only be customized by applying a css or providing a custom implementation of the hardcoded part.

Option 2
Use partially the implementation proposed in the django-angular documentation
            http://django-angular.readthedocs.org/en/latest/angular-form-validation.html
The modal form template should be modified to add required ng attributes to the current error related tags. The layout of the template should also be changed to support the error data model provided by django-angular.
This is the preferred option by the authors of the blueprint.

NOTE:
This integration of django-angular will affect all the modal forms in Horizon. Each validation rule defined in forms will be propagated to client-side without duplication code and translation messages.

---------------------------------------------------------------------------------------------------------------------------------------

[veronica-a-musso 2014-06-02]
django-angular is not included in Ubuntu/Fedora packages, this is a blocking issue.
The django- angular's developers have been contacted to figure out possible next steps.

[david-lyle 2014.07.14] Moving milestone to j-3

[david-lyle 2014.08.11] Moving out of Juno

[jpichon 2014.10.21] Unassigning due to lack of activity - feel free to pick it up again if you're still interested!

[jtomasek 2014-10-18] There is some valuable input on using django-angular in this discussion http://lists.openstack.org/pipermail/openstack-dev/2014-November/050106.html

[lawrancejing 2014.11.30] wow, it's cool, and i test it with horizon master branch, and it works fine, but i don't know whether django-angular is not included in Ubuntu/Fedora packages,
so when should we start the BP?

[lawrancejing 2014.12.01] hello, about Option 2, what ng attributes should we add in the modal form?

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.