Created
July 26, 2010 14:42
-
-
Save mailarchis/490625 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
class AddressWidget(forms.MultiWidget): | |
""" | |
Custom widget for Custom Field AddressField | |
""" | |
def __init__(self, country_choices, city_choices, locality_choices, attrs=None): | |
widgets = (forms.TextInput(), forms.TextInput(), forms.Select(attrs=attrs, choices=country_choices), forms.Select(attrs=attrs, choices=city_choices),forms.Select(attrs=attrs, choices=locality_choices), forms.TextInput()) | |
super(AddressWidget, self).__init__(widgets, attrs) | |
def decompress(self, value): | |
if value: | |
return value | |
return [None,None,None,None,None,None] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment