#5446: New model fields for languages and countries at least
----------------------------------------------------------+-----------------
          Reporter:  RaphaĆ«l Hertzog <[email protected]>  |         Owner:  
marinho        
            Status:  reopened                             |     Milestone:      
           
         Component:  Database layer (models, ORM)         |       Version:  SVN 
           
        Resolution:                                       |      Keywords:  
feature_request
             Stage:  Accepted                             |     Has_patch:  1   
           
        Needs_docs:  0                                    |   Needs_tests:  0   
           
Needs_better_patch:  0                                    |  
----------------------------------------------------------+-----------------
Changes (by phxx):

 * cc: [email protected] (added)

Comment:

 I like the COUNTRIES choices in the
 django/contrib/localflavor/generic/__init__.py file of the patch. It would
 be nice if there would be something like prefered countries that appear
 first in the choicelist - because Afghanistan is a quite bad default in
 most cases. Here is a possible implementation that uses a
 PREFERED_COUNTRIES setting:

 {{{
 def prefer_countries(countries, prefer=(), separator='-' * 5):
     prefered_countries = []
     for country in countries:
         if country[0] in prefer:
             prefered_countries.append(country)
     countries = list(countries)
     countries = prefered_countries + [('', separator)] + countries
     return tuple(countries)

 COUNTRIES = prefer_countries(COUNTRIES, settings.PREFERED_COUNTRIES)
 }}}

 What do you think?

-- 
Ticket URL: <http://code.djangoproject.com/ticket/5446#comment:20>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.


Reply via email to