Changeset 5135
- Timestamp:
- 05/01/07 10:33:10 (1 year ago)
- Files:
-
- django/branches/boulder-oracle-sprint/AUTHORS (modified) (2 diffs)
- django/branches/boulder-oracle-sprint/django/contrib/localflavor/ch (copied) (copied from django/trunk/django/contrib/localflavor/ch)
- django/branches/boulder-oracle-sprint/django/contrib/localflavor/ch/ch_states.py (copied) (copied from django/trunk/django/contrib/localflavor/ch/ch_states.py)
- django/branches/boulder-oracle-sprint/django/contrib/localflavor/ch/forms.py (copied) (copied from django/trunk/django/contrib/localflavor/ch/forms.py)
- django/branches/boulder-oracle-sprint/django/contrib/localflavor/ch/__init__.py (copied) (copied from django/trunk/django/contrib/localflavor/ch/__init__.py)
- django/branches/boulder-oracle-sprint/django/core/management.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/db/models/fields/__init__.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/django/db/models/query.py (modified) (2 diffs)
- django/branches/boulder-oracle-sprint/docs/settings.txt (modified) (1 diff)
- django/branches/boulder-oracle-sprint/tests/modeltests/custom_columns/models.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/tests/modeltests/lookup/models.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/tests/modeltests/many_to_one/models.py (modified) (2 diffs)
- django/branches/boulder-oracle-sprint/tests/modeltests/reverse_lookup/models.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/tests/regressiontests/forms/localflavor.py (modified) (1 diff)
- django/branches/boulder-oracle-sprint/tests/regressiontests/null_queries/models.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/boulder-oracle-sprint/AUTHORS
r5114 r5135 182 182 plisk 183 183 Daniel Poelzleithner <http://poelzi.org/> 184 polpak@yahoo.com 184 185 J. Rademaker 185 186 Michael Radziej <mir@noris.de> … … 225 226 Dan Watson <http://theidioteque.net/> 226 227 Chris Wesseling <Chris.Wesseling@cwi.nl> 228 charly.wilhelm@gmail.com 227 229 Rachel Willmer <http://www.willmer.com/kb/> 228 230 Gary Wilson <gary.wilson@gmail.com> django/branches/boulder-oracle-sprint/django/core/management.py
r5114 r5135 599 599 # is a model we've just created) 600 600 for app in models.get_apps(): 601 app_name = app.__name__.split('.')[-2] 601 602 for model in models.get_models(app): 602 603 if model in created_models: django/branches/boulder-oracle-sprint/django/db/models/fields/__init__.py
r5128 r5135 894 894 return [oldforms.USStateField] 895 895 896 def formfield(self, **kwargs): 897 from django.contrib.localflavor.us.forms import USStateSelect 898 defaults = {'widget': USStateSelect} 899 defaults.update(kwargs) 900 return super(USStateField, self).formfield(**defaults) 901 896 902 class XMLField(TextField): 897 903 def __init__(self, verbose_name=None, name=None, schema_path=None, **kwargs): django/branches/boulder-oracle-sprint/django/db/models/query.py
r5034 r5135 904 904 return matches[0] 905 905 906 def field_choices(field_list, related_query): 907 if related_query: 908 choices = [f.field.related_query_name() for f in field_list] 909 else: 910 choices = [f.name for f in field_list] 911 return choices 912 906 913 def lookup_inner(path, lookup_type, value, opts, table, column): 907 914 qn = backend.quote_name … … 988 995 pass 989 996 else: # No match found. 990 raise TypeError, "Cannot resolve keyword '%s' into field" % name 997 choices = field_choices(current_opts.many_to_many, False) + \ 998 field_choices(current_opts.get_all_related_many_to_many_objects(), True) + \ 999 field_choices(current_opts.get_all_related_objects(), True) + \ 1000 field_choices(current_opts.fields, False) 1001 raise TypeError, "Cannot resolve keyword '%s' into field, choices are: %s" % (name, ", ".join(choices)) 991 1002 992 1003 # Check whether an intermediate join is required between current_table django/branches/boulder-oracle-sprint/docs/settings.txt
r5128 r5135 501 501 --------- 502 502 503 Default: A tuple of all available languages. Currently, this is:: 504 505 LANGUAGES = ( 506 ('ar', _('Arabic')), 507 ('bn', _('Bengali')), 508 ('cs', _('Czech')), 509 ('cy', _('Welsh')), 510 ('da', _('Danish')), 511 ('de', _('German')), 512 ('el', _('Greek')), 513 ('en', _('English')), 514 ('es', _('Spanish')), 515 ('es_AR', _('Argentinean Spanish')), 516 ('fr', _('French')), 517 ('gl', _('Galician')), 518 ('hu', _('Hungarian')), 519 ('he', _('Hebrew')), 520 ('is', _('Icelandic')), 521 ('it', _('Italian')), 522 ('ja', _('Japanese')), 523 ('nl', _('Dutch')), 524 ('no', _('Norwegian')), 525 ('pt-br', _('Brazilian')), 526 ('ro', _('Romanian')), 527 ('ru', _('Russian')), 528 ('sk', _('Slovak')), 529 ('sl', _('Slovenian')), 530 ('sr', _('Serbian')), 531 ('sv', _('Swedish')), 532 ('ta', _('Tamil')), 533 ('uk', _('Ukrainian')), 534 ('zh-cn', _('Simplified Chinese')), 535 ('zh-tw', _('Traditional Chinese')), 536 ) 537 538 A tuple of two-tuples in the format (language code, language name). This 539 specifies which languages are available for language selection. See the 540 `internationalization docs`_ for details. 503 Default: A tuple of all available languages. This list is continually growing 504 and including a copy here would inevitably become rapidly out of date. You can 505 see the current list of translated languages by looking in 506 ``django/conf/global_settings.py`` (or view the `online source`_). 507 508 .. _online source: http://code.djangoproject.com/browser/django/trunk/django/conf/global_settings.py 509 510 The list is a tuple of two-tuples in the format (language code, language 511 name) -- for example, ``('ja', 'Japanese')``. This specifies which languages 512 are available for language selection. See the `internationalization docs`_ for 513 details. 541 514 542 515 Generally, the default value should suffice. Only set this setting if you want django/branches/boulder-oracle-sprint/tests/modeltests/custom_columns/models.py
r4456 r5135 72 72 Traceback (most recent call last): 73 73 ... 74 TypeError: Cannot resolve keyword 'firstname' into field 74 TypeError: Cannot resolve keyword 'firstname' into field, choices are: article, id, first_name, last_name 75 75 76 76 >>> a = Author.objects.get(last_name__exact='Smith') django/branches/boulder-oracle-sprint/tests/modeltests/lookup/models.py
r4695 r5135 224 224 Traceback (most recent call last): 225 225 ... 226 TypeError: Cannot resolve keyword 'pub_date_year' into field 226 TypeError: Cannot resolve keyword 'pub_date_year' into field, choices are: id, headline, pub_date 227 227 228 228 >>> Article.objects.filter(headline__starts='Article') 229 229 Traceback (most recent call last): 230 230 ... 231 TypeError: Cannot resolve keyword 'headline__starts' into field 231 TypeError: Cannot resolve keyword 'headline__starts' into field, choices are: id, headline, pub_date 232 232 233 233 """} django/branches/boulder-oracle-sprint/tests/modeltests/many_to_one/models.py
r4729 r5135 175 175 Traceback (most recent call last): 176 176 ... 177 TypeError: Cannot resolve keyword 'reporter_id' into field 177 TypeError: Cannot resolve keyword 'reporter_id' into field, choices are: id, headline, pub_date, reporter 178 178 179 179 # You need to specify a comparison clause … … 181 181 Traceback (most recent call last): 182 182 ... 183 TypeError: Cannot resolve keyword 'reporter_id' into field 183 TypeError: Cannot resolve keyword 'reporter_id' into field, choices are: id, headline, pub_date, reporter 184 184 185 185 # You can also instantiate an Article by passing django/branches/boulder-oracle-sprint/tests/modeltests/reverse_lookup/models.py
r3661 r5135 56 56 Traceback (most recent call last): 57 57 ... 58 TypeError: Cannot resolve keyword 'choice' into field 58 TypeError: Cannot resolve keyword 'choice' into field, choices are: poll_choice, related_choice, id, question, creator 59 59 """} django/branches/boulder-oracle-sprint/tests/regressiontests/forms/localflavor.py
r5114 r5135 1012 1012 ValidationError: [u'Enter a valid German identity card number in XXXXXXXXXXX-XXXXXXX-XXXXXXX-X format.'] 1013 1013 1014 # CHZipCodeField ############################################################ 1015 1016 >>> from django.contrib.localflavor.ch.forms import CHZipCodeField 1017 >>> f = CHZipCodeField() 1018 >>> f.clean('800x') 1019 Traceback (most recent call last): 1020 ... 1021 ValidationError: [u'Enter a zip code in the format XXXX.'] 1022 >>> f.clean('80 00') 1023 Traceback (most recent call last): 1024 ... 1025 ValidationError: [u'Enter a zip code in the format XXXX.'] 1026 >>> f.clean('8000') 1027 u'8000' 1028 1029 # CHPhoneNumberField ######################################################## 1030 1031 >>> from django.contrib.localflavor.ch.forms import CHPhoneNumberField 1032 >>> f = CHPhoneNumberField() 1033 >>> f.clean('01234567890') 1034 Traceback (most recent call last): 1035 ... 1036 ValidationError: [u'Phone numbers must be in 0XX XXX XX XX format.'] 1037 >>> f.clean('1234567890') 1038 Traceback (most recent call last): 1039 ... 1040 ValidationError: [u'Phone numbers must be in 0XX XXX XX XX format.'] 1041 >>> f.clean('0123456789') 1042 u'012 345 67 89' 1043 1044 # CHIdentityCardNumberField ################################################# 1045 1046 >>> from django.contrib.localflavor.ch.forms import CHIdentityCardNumberField 1047 >>> f = CHIdentityCardNumberField() 1048 >>> f.clean('C1234567<0') 1049 u'C1234567<0' 1050 >>> f.clean('C1234567<1') 1051 Traceback (most recent call last): 1052 ... 1053 ValidationError: [u'Enter a valid Swiss identity or passport card number in X1234567<0 or 1234567890 format.'] 1054 >>> f.clean('2123456700') 1055 u'2123456700' 1056 >>> f.clean('2123456701') 1057 Traceback (most recent call last): 1058 ... 1059 ValidationError: [u'Enter a valid Swiss identity or passport card number in X1234567<0 or 1234567890 format.'] 1060 1061 # CHStateSelect ############################################################# 1062 1063 >>> from django.contrib.localflavor.ch.forms import CHStateSelect 1064 >>> w = CHStateSelect() 1065 >>> w.render('state', 'AG') 1066 u'<select name="state">\n<option value="AG" selected="selected">Aargau</option>\n<option value="AI">Appenzell Innerrhoden</option>\n<option value="AR">Appenzell Ausserrhoden</option>\n<option value="BS">Basel-Stadt</option>\n<option value="BL">Basel-Land</option>\n<option value="BE">Berne</option>\n<option value="FR">Fribourg</option>\n<option value="GE">Geneva</option>\n<option value="GL">Glarus</option>\n<option value="GR">Graubuenden</option>\n<option value="JU">Jura</option>\n<option value="LU">Lucerne</option>\n<option value="NE">Neuchatel</option>\n<option value="NW">Nidwalden</option>\n<option value="OW">Obwalden</option>\n<option value="SH">Schaffhausen</option>\n<option value="SZ">Schwyz</option>\n<option value="SO">Solothurn</option>\n<option value="SG">St. Gallen</option>\n<option value="TG">Thurgau</option>\n<option value="TI">Ticino</option>\n<option value="UR">Uri</option>\n<option value="VS">Valais</option>\n<option value="VD">Vaud</option>\n<option value="ZG">Zug</option>\n<option value="ZH">Zurich</option>\n</select>' 1067 1014 1068 ## AUPostCodeField ########################################################## 1015 1069 django/branches/boulder-oracle-sprint/tests/regressiontests/null_queries/models.py
r3902 r5135 33 33 Traceback (most recent call last): 34 34 ... 35 TypeError: Cannot resolve keyword 'foo' into field 35 TypeError: Cannot resolve keyword 'foo' into field, choices are: id, poll, choice 36 36 37 37 # Can't use None on anything other than __exact
