Django form extended validation linked to jquery.validate.js
Project description
Important steps:
* include 'validation_extended' in yours INSTALLED_APPS
* read docstrings from validation_extended.validation
Package features:
- Turns form validation represent like so:
# forms.py
from validation_extended import AutoValidated
class SomeForm(AutoValidated, django.forms.ModelForm): # or django.forms.Form as base class
class Meta:
model = SomeModel
class Validators:
class RequiresAll:
foo = [foo_validator]
bar = [bar_validator]
baz = [baz_validator(5)]
- Forms can make rules for jquery.validate if form class was inherited from ClientValidation
and all validators were inherited from Validator class and written like so:
# validators.py
from validation_extended import Validator
class SimpleValidator(Validator):
message = "simple validator error"
client_events = "focusout keyup"
data = {'values': [1, 2, 3]}
def js_rules(self):
pass
def validated(self, field_name, data):
if not data in self.data['values']:
self.raise_error()
- It also provide remote validation. To use it include next lines in your urls.py:
# urls.py
urlpatterns += patterns(
url(r'^validation/', include('validation_extended.urls')))
* include 'validation_extended' in yours INSTALLED_APPS
* read docstrings from validation_extended.validation
Package features:
- Turns form validation represent like so:
# forms.py
from validation_extended import AutoValidated
class SomeForm(AutoValidated, django.forms.ModelForm): # or django.forms.Form as base class
class Meta:
model = SomeModel
class Validators:
class RequiresAll:
foo = [foo_validator]
bar = [bar_validator]
baz = [baz_validator(5)]
- Forms can make rules for jquery.validate if form class was inherited from ClientValidation
and all validators were inherited from Validator class and written like so:
# validators.py
from validation_extended import Validator
class SimpleValidator(Validator):
message = "simple validator error"
client_events = "focusout keyup"
data = {'values': [1, 2, 3]}
def js_rules(self):
pass
def validated(self, field_name, data):
if not data in self.data['values']:
self.raise_error()
- It also provide remote validation. To use it include next lines in your urls.py:
# urls.py
urlpatterns += patterns(
url(r'^validation/', include('validation_extended.urls')))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django-extended-forms-validation-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f08b6f1833b3eb85294a8fde36b1ee422cd9f6f7721e84d6b74c4226d833401e |
|
MD5 | 41ce2dfae3c80749b187c888f5b2f98f |
|
BLAKE2b-256 | 9b4667b4d8235dce229bade48160bff7bfcb6ca8fb539eedb868da44ea3f6592 |