Removed julian/tests.py and julian/views.py. Switched Location handling from a settin...
[philo.git] / contrib / julian / fields.py
1 from django.contrib.localflavor.us.forms import USZipCodeField as USZipCodeFormField
2 from django.core.validators import RegexValidator
3 from django.db import models
4
5
6 class USZipCodeField(models.CharField):
7         default_validators = [RegexValidator(r'^\d{5}(?:-\d{4})?$')]
8         
9         def __init__(self, *args, **kwargs):
10                 kwargs['max_length'] = 10
11                 super(USZipCodeField, self).__init__(*args, **kwargs)
12         
13         def formfield(self, form_class=USZipCodeFormField, **kwargs):
14                 return super(USZipCodeField, self).formfield(form_class, **kwargs)
15
16
17 try:
18         from south.modelsinspector import add_introspection_rules
19 except ImportError:
20         pass
21 else:
22         add_introspection_rules([], ["^philo\.contrib\.julian\.fields\.USZipCodeField"])