Skip to content

Instantly share code, notes, and snippets.

@lightstrike
Created October 28, 2014 20:12
Show Gist options
  • Save lightstrike/000565cf6d240afada1b to your computer and use it in GitHub Desktop.
Save lightstrike/000565cf6d240afada1b to your computer and use it in GitHub Desktop.
Experimenting with how to customize django-parsley
def get_selector(*args):
return ''.join([a for a in args])
def get_parsley_errors_data(parsley_attr, fields):
parsley_extras = dict()
for field in fields:
field_dict = {}
field_slug = slugify(field)
field_dict[parsley_attr] = get_selector(
'.', field_slug, '-', c.ERRORS_CLASS)
parsley_extras[field] = field_dict
return parsley_extras
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment