Skip to content

Commit

Permalink
Merge pull request #17 from jsmolina/feature/time_field
Browse files Browse the repository at this point in the history
ADD django field time support
  • Loading branch information
jsmolina committed Nov 27, 2013
2 parents 68de727 + 99e658f commit f5cb5f5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions django_jquery_validate/templatetags/jquery_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def preprocess_fields(self, form):
elif isinstance(form.fields[key], forms.fields.DateField):
field_dict['date'] = True

elif isinstance(form.fields[key], forms.fields.TimeField):
field_dict['time'] = True

elif isinstance(form.fields[key], forms.fields.URLField):
field_dict['url'] = True

Expand Down Expand Up @@ -132,6 +135,8 @@ def map_messages(field, validate_dict):
custom_or_default(field, validate_dict['messages'][field.name], 'invalid', 'url', 'Invalid url')
elif 'date' in validate_dict['rules'][field.name]:
custom_or_default(field, validate_dict['messages'][field.name], 'invalid', 'date', 'Invalid date')
elif 'time' in validate_dict['rules'][field.name]:
custom_or_default(field, validate_dict['messages'][field.name], 'invalid', 'time', 'Invalid time')
elif 'pattern' in validate_dict['rules'][field.name]:
custom_or_default(field, validate_dict['messages'][field.name], 'regex_pattern', 'pattern', '')

Expand Down

0 comments on commit f5cb5f5

Please sign in to comment.