Last active
August 29, 2015 13:55
-
-
Save AntelopeSalad/8692835 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django import forms | |
from django.db import models | |
from south.modelsinspector import add_introspection_rules | |
class ParsleyDecimalFormField(forms.DecimalField): | |
def widget_attrs(self, widget): | |
attrs = super().widget_attrs(widget) | |
# ... | |
return attrs | |
class ParsleyDecimalField(models.DecimalField): | |
def formfield(self, **kwargs): | |
defaults = {'form_class': ParsleyDecimalFormField} | |
defaults.update(kwargs) | |
return super().formfield(**defaults) | |
add_introspection_rules([], ['^\.ParsleyDecimalField'],) | |
add_introspection_rules([], ['^myapp\.fields\.ParsleyDecimalField'],) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment