Commits

Evgeny Lychkovsky  committed 3b3d6cb

Move sort to CountryField

  • Participants
  • Parent commits 0504ffa

Comments (0)

Files changed (1)

File django_countries/fields.py

         kwargs.setdefault('max_length', 2) 
         kwargs.setdefault('choices', COUNTRIES) 
 
-        super(CharField, self).__init__(*args, **kwargs) 
+        super(CharField, self).__init__(*args, **kwargs)
+        self._choices = sorted(self.choices, key=lambda c: c[1])
 
     def get_internal_type(self): 
         return "CharField"
         return unicode(value)
 
 
-class SortedCountryField(CountryField):
-    def __init__(self, *args, **kwargs):
-        super(SortedCountryField, self).__init__(*args, **kwargs)
-        self._choices = sorted(self.choices, key=lambda c: c[1])
-
-        
 # If south is installed, ensure that CountryField will be introspected just
 # like a normal CharField.
 try:
     from south.modelsinspector import add_introspection_rules
     add_introspection_rules([], ['^django_countries\.fields\.CountryField'])
-    add_introspection_rules([], ['^django_countries\.fields\.SortedCountryField'])
 except ImportError:
     pass