mirror of
https://github.com/django/django.git
synced 2025-07-04 09:49:12 +00:00
newforms-admin: Merged to [4939]
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@4940 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e2b49c379a
commit
94aeccf18e
9
AUTHORS
9
AUTHORS
@ -42,6 +42,7 @@ people who have submitted patches, reported bugs, added translations, helped
|
|||||||
answer newbie questions, and generally made Django that much better:
|
answer newbie questions, and generally made Django that much better:
|
||||||
|
|
||||||
adurdin@gmail.com
|
adurdin@gmail.com
|
||||||
|
Daniel Alves Barbosa de Oliveira Vaz <danielvaz@gmail.com>
|
||||||
Andreas
|
Andreas
|
||||||
andy@jadedplanet.net
|
andy@jadedplanet.net
|
||||||
Fabrice Aneche <akh@nobugware.com>
|
Fabrice Aneche <akh@nobugware.com>
|
||||||
@ -64,9 +65,11 @@ answer newbie questions, and generally made Django that much better:
|
|||||||
Chris Chamberlin <dja@cdc.msbx.net>
|
Chris Chamberlin <dja@cdc.msbx.net>
|
||||||
Amit Chakradeo <http://amit.chakradeo.net/>
|
Amit Chakradeo <http://amit.chakradeo.net/>
|
||||||
ChaosKCW
|
ChaosKCW
|
||||||
|
ivan.chelubeev@gmail.com
|
||||||
Ian Clelland <clelland@gmail.com>
|
Ian Clelland <clelland@gmail.com>
|
||||||
crankycoder@gmail.com
|
crankycoder@gmail.com
|
||||||
Matt Croydon <http://www.postneo.com/>
|
Matt Croydon <http://www.postneo.com/>
|
||||||
|
flavio.curella@gmail.com
|
||||||
Jure Cuhalev <gandalf@owca.info>
|
Jure Cuhalev <gandalf@owca.info>
|
||||||
dackze+django@gmail.com
|
dackze+django@gmail.com
|
||||||
Dirk Datzert <dummy@habmalnefrage.de>
|
Dirk Datzert <dummy@habmalnefrage.de>
|
||||||
@ -125,6 +128,7 @@ answer newbie questions, and generally made Django that much better:
|
|||||||
Nicola Larosa <nico@teknico.net>
|
Nicola Larosa <nico@teknico.net>
|
||||||
Eugene Lazutkin <http://lazutkin.com/blog/>
|
Eugene Lazutkin <http://lazutkin.com/blog/>
|
||||||
Jeong-Min Lee <falsetru@gmail.com>
|
Jeong-Min Lee <falsetru@gmail.com>
|
||||||
|
Jannis Leidel <jl@websushi.org>
|
||||||
Christopher Lenz <http://www.cmlenz.net/>
|
Christopher Lenz <http://www.cmlenz.net/>
|
||||||
lerouxb@gmail.com
|
lerouxb@gmail.com
|
||||||
Waylan Limberg <waylan@gmail.com>
|
Waylan Limberg <waylan@gmail.com>
|
||||||
@ -154,6 +158,7 @@ answer newbie questions, and generally made Django that much better:
|
|||||||
oggie rob <oz.robharvey@gmail.com>
|
oggie rob <oz.robharvey@gmail.com>
|
||||||
Jay Parlar <parlar@gmail.com>
|
Jay Parlar <parlar@gmail.com>
|
||||||
pavithran s <pavithran.s@gmail.com>
|
pavithran s <pavithran.s@gmail.com>
|
||||||
|
Barry Pederson <bp@barryp.org>
|
||||||
pgross@thoughtworks.com
|
pgross@thoughtworks.com
|
||||||
phaedo <http://phaedo.cx/>
|
phaedo <http://phaedo.cx/>
|
||||||
phil@produxion.net
|
phil@produxion.net
|
||||||
@ -177,13 +182,17 @@ answer newbie questions, and generally made Django that much better:
|
|||||||
SmileyChris <smileychris@gmail.com>
|
SmileyChris <smileychris@gmail.com>
|
||||||
smurf@smurf.noris.de
|
smurf@smurf.noris.de
|
||||||
sopel
|
sopel
|
||||||
|
Wiliam Alves de Souza <wiliamsouza83@gmail.com>
|
||||||
Georgi Stanojevski <glisha@gmail.com>
|
Georgi Stanojevski <glisha@gmail.com>
|
||||||
Thomas Steinacher <http://www.eggdrop.ch/>
|
Thomas Steinacher <http://www.eggdrop.ch/>
|
||||||
nowell strite
|
nowell strite
|
||||||
Radek Švarz <http://www.svarz.cz/translate/>
|
Radek Švarz <http://www.svarz.cz/translate/>
|
||||||
Swaroop C H <http://www.swaroopch.info>
|
Swaroop C H <http://www.swaroopch.info>
|
||||||
Aaron Swartz <http://www.aaronsw.com/>
|
Aaron Swartz <http://www.aaronsw.com/>
|
||||||
|
Ville Säävuori <http://www.unessa.net/>
|
||||||
Tyson Tate <tyson@fallingbullets.com>
|
Tyson Tate <tyson@fallingbullets.com>
|
||||||
|
thebjorn <bp@datakortet.no>
|
||||||
|
Zach Thompson <zthompson47@gmail.com>
|
||||||
Tom Tobin
|
Tom Tobin
|
||||||
Joe Topjian <http://joe.terrarum.net/geek/code/python/django/>
|
Joe Topjian <http://joe.terrarum.net/geek/code/python/django/>
|
||||||
torne-django@wolfpuppy.org.uk
|
torne-django@wolfpuppy.org.uk
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
|
include README
|
||||||
include AUTHORS
|
include AUTHORS
|
||||||
include INSTALL
|
include INSTALL
|
||||||
include LICENSE
|
include LICENSE
|
||||||
|
include MANIFEST.in
|
||||||
recursive-include docs *
|
recursive-include docs *
|
||||||
recursive-include scripts *
|
recursive-include scripts *
|
||||||
|
recursive-include examples *
|
||||||
|
recursive-include extras *
|
||||||
recursive-include django/conf/locale *
|
recursive-include django/conf/locale *
|
||||||
recursive-include django/contrib/admin/templates *
|
recursive-include django/contrib/admin/templates *
|
||||||
recursive-include django/contrib/admin/media *
|
recursive-include django/contrib/admin/media *
|
||||||
|
@ -1 +1 @@
|
|||||||
VERSION = (0, 96, 'newforms-admin')
|
VERSION = (0, 97, 'newforms-admin')
|
||||||
|
@ -31,9 +31,9 @@ def compile_messages(locale=None):
|
|||||||
os.environ['djangocompilemo'] = pf + '.mo'
|
os.environ['djangocompilemo'] = pf + '.mo'
|
||||||
os.environ['djangocompilepo'] = pf + '.po'
|
os.environ['djangocompilepo'] = pf + '.po'
|
||||||
if sys.platform == 'win32': # Different shell-variable syntax
|
if sys.platform == 'win32': # Different shell-variable syntax
|
||||||
cmd = 'msgfmt -o "%djangocompilemo%" "%djangocompilepo%"'
|
cmd = 'msgfmt --check-format -o "%djangocompilemo%" "%djangocompilepo%"'
|
||||||
else:
|
else:
|
||||||
cmd = 'msgfmt -o "$djangocompilemo" "$djangocompilepo"'
|
cmd = 'msgfmt --check-format -o "$djangocompilemo" "$djangocompilepo"'
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -673,19 +673,19 @@ msgstr "L'URL est un lien cassé."
|
|||||||
|
|
||||||
#: contrib/humanize/templatetags/humanize.py:16
|
#: contrib/humanize/templatetags/humanize.py:16
|
||||||
msgid "th"
|
msgid "th"
|
||||||
msgstr "e"
|
msgstr "<sup>e</sup>"
|
||||||
|
|
||||||
#: contrib/humanize/templatetags/humanize.py:16
|
#: contrib/humanize/templatetags/humanize.py:16
|
||||||
msgid "st"
|
msgid "st"
|
||||||
msgstr "er"
|
msgstr "<sup>er</sup>"
|
||||||
|
|
||||||
#: contrib/humanize/templatetags/humanize.py:16
|
#: contrib/humanize/templatetags/humanize.py:16
|
||||||
msgid "nd"
|
msgid "nd"
|
||||||
msgstr "d"
|
msgstr "<sup>d</sup>"
|
||||||
|
|
||||||
#: contrib/humanize/templatetags/humanize.py:16
|
#: contrib/humanize/templatetags/humanize.py:16
|
||||||
msgid "rd"
|
msgid "rd"
|
||||||
msgstr "e"
|
msgstr "<sup>e</sup>"
|
||||||
|
|
||||||
#: contrib/humanize/templatetags/humanize.py:48
|
#: contrib/humanize/templatetags/humanize.py:48
|
||||||
#, python-format
|
#, python-format
|
||||||
@ -1346,7 +1346,7 @@ msgstr "Sélectionnez %s pour changer"
|
|||||||
|
|
||||||
#: contrib/admin/views/main.py:768
|
#: contrib/admin/views/main.py:768
|
||||||
msgid "Database error"
|
msgid "Database error"
|
||||||
msgstr ""
|
msgstr "Erreur de base de données"
|
||||||
|
|
||||||
#: contrib/admin/views/doc.py:46 contrib/admin/views/doc.py:48
|
#: contrib/admin/views/doc.py:46 contrib/admin/views/doc.py:48
|
||||||
#: contrib/admin/views/doc.py:50
|
#: contrib/admin/views/doc.py:50
|
||||||
@ -1391,7 +1391,7 @@ msgstr "les objets `%(label)s.%(type)s en relation"
|
|||||||
#: contrib/admin/views/doc.py:219
|
#: contrib/admin/views/doc.py:219
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "all %s"
|
msgid "all %s"
|
||||||
msgstr ""
|
msgstr "tous les %s"
|
||||||
|
|
||||||
#: contrib/admin/views/doc.py:224
|
#: contrib/admin/views/doc.py:224
|
||||||
#, python-format
|
#, python-format
|
||||||
@ -1401,7 +1401,7 @@ msgstr "nombre de %s"
|
|||||||
#: contrib/admin/views/doc.py:229
|
#: contrib/admin/views/doc.py:229
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Fields on %s objects"
|
msgid "Fields on %s objects"
|
||||||
msgstr ""
|
msgstr "Champs sur les objets %s"
|
||||||
|
|
||||||
#: contrib/admin/views/doc.py:291 contrib/admin/views/doc.py:301
|
#: contrib/admin/views/doc.py:291 contrib/admin/views/doc.py:301
|
||||||
#: contrib/admin/views/doc.py:303 contrib/admin/views/doc.py:309
|
#: contrib/admin/views/doc.py:303 contrib/admin/views/doc.py:309
|
||||||
@ -1613,7 +1613,8 @@ msgid ""
|
|||||||
"Something's wrong with your database installation. Make sure the appropriate "
|
"Something's wrong with your database installation. Make sure the appropriate "
|
||||||
"database tables have been created, and make sure the database is readable by "
|
"database tables have been created, and make sure the database is readable by "
|
||||||
"the appropriate user."
|
"the appropriate user."
|
||||||
msgstr ""
|
msgstr "Quelque chose ne va pas avec votre base de données. Vérifiez que les"
|
||||||
|
"bonnes bases ont été créées, et qu'elle est lisible par le bon utilisateur."
|
||||||
|
|
||||||
#: contrib/admin/templates/admin/search_form.html:8
|
#: contrib/admin/templates/admin/search_form.html:8
|
||||||
msgid "Go"
|
msgid "Go"
|
||||||
@ -1930,6 +1931,13 @@ msgid ""
|
|||||||
"as \"internal\" (talk to your system administrator if you aren't sure if\n"
|
"as \"internal\" (talk to your system administrator if you aren't sure if\n"
|
||||||
"your computer is \"internal\").</p>\n"
|
"your computer is \"internal\").</p>\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"\n"
|
||||||
|
"<p class=\"help\">Pour installer des bookmarklets, faîtes glisser le lien vers\n"
|
||||||
|
"votre barre de marques-pages, ou cliquez droit dessus et ajoutez-y le.\n"
|
||||||
|
"Maintenant vous pouvez le sélectionner depuis n'importe quelle page\n"
|
||||||
|
"du site. Notez que certains d'entre eux nécessitent que vous visionniez\n"
|
||||||
|
"le site depuis un ordinateur dit \"interne\" (veuillez contacter votre\n"
|
||||||
|
"administrateur système si vous n'êtes pas sûr que votre ordinateur le soit).</p>\n"
|
||||||
|
|
||||||
#: contrib/admin/templates/admin_doc/bookmarklets.html:19
|
#: contrib/admin/templates/admin_doc/bookmarklets.html:19
|
||||||
msgid "Documentation for this page"
|
msgid "Documentation for this page"
|
||||||
|
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
# Translation of django.po to japanese.
|
# Translation of django.po to japanese.
|
||||||
# Copyright (C) 2005,2006 THE PACKAGE'S COPYRIGHT HOLDER
|
# Copyright (C) 2005,2006,2007 makoto tsuyuki
|
||||||
# This file is distributed under the same license as the PACKAGE package.
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
# makoto tsuyuki <mtsuyuki@gmail.com>, 2005,2006,2007.
|
# makoto tsuyuki <mtsuyuki@gmail.com>, 2005,2006,2007.
|
||||||
#
|
#
|
||||||
@ -7,7 +7,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Django 1.0\n"
|
"Project-Id-Version: Django 1.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2007-02-15 23:43+0900\n"
|
"POT-Creation-Date: 2007-03-26 22:51+0900\n"
|
||||||
"PO-Revision-Date: 2006-05-18 00:28+0900\n"
|
"PO-Revision-Date: 2006-05-18 00:28+0900\n"
|
||||||
"Last-Translator: makoto tsuyuki <mtsuyuki@gmail.com>\n"
|
"Last-Translator: makoto tsuyuki <mtsuyuki@gmail.com>\n"
|
||||||
"Language-Team: Japanese <django-ja@googlegroups.com>\n"
|
"Language-Team: Japanese <django-ja@googlegroups.com>\n"
|
||||||
@ -92,70 +92,82 @@ msgid "Japanese"
|
|||||||
msgstr "日本語"
|
msgstr "日本語"
|
||||||
|
|
||||||
#: conf/global_settings.py:58
|
#: conf/global_settings.py:58
|
||||||
|
msgid "Kannada"
|
||||||
|
msgstr "カンナダ語"
|
||||||
|
|
||||||
|
#: conf/global_settings.py:59
|
||||||
msgid "Latvian"
|
msgid "Latvian"
|
||||||
msgstr "ラトビア語"
|
msgstr "ラトビア語"
|
||||||
|
|
||||||
#: conf/global_settings.py:59
|
#: conf/global_settings.py:60
|
||||||
msgid "Macedonian"
|
msgid "Macedonian"
|
||||||
msgstr "マケドニア語"
|
msgstr "マケドニア語"
|
||||||
|
|
||||||
#: conf/global_settings.py:60
|
#: conf/global_settings.py:61
|
||||||
msgid "Dutch"
|
msgid "Dutch"
|
||||||
msgstr "オランダ語"
|
msgstr "オランダ語"
|
||||||
|
|
||||||
#: conf/global_settings.py:61
|
#: conf/global_settings.py:62
|
||||||
msgid "Norwegian"
|
msgid "Norwegian"
|
||||||
msgstr "ノルウェー語"
|
msgstr "ノルウェー語"
|
||||||
|
|
||||||
#: conf/global_settings.py:62
|
#: conf/global_settings.py:63
|
||||||
msgid "Polish"
|
msgid "Polish"
|
||||||
msgstr "ポーランド語"
|
msgstr "ポーランド語"
|
||||||
|
|
||||||
#: conf/global_settings.py:63
|
#: conf/global_settings.py:64
|
||||||
|
msgid "Portugese"
|
||||||
|
msgstr "ポルトガル語"
|
||||||
|
|
||||||
|
#: conf/global_settings.py:65
|
||||||
msgid "Brazilian"
|
msgid "Brazilian"
|
||||||
msgstr "ブラジル語"
|
msgstr "ブラジル語"
|
||||||
|
|
||||||
#: conf/global_settings.py:64
|
#: conf/global_settings.py:66
|
||||||
msgid "Romanian"
|
msgid "Romanian"
|
||||||
msgstr "ルーマニア語"
|
msgstr "ルーマニア語"
|
||||||
|
|
||||||
#: conf/global_settings.py:65
|
#: conf/global_settings.py:67
|
||||||
msgid "Russian"
|
msgid "Russian"
|
||||||
msgstr "ロシア語"
|
msgstr "ロシア語"
|
||||||
|
|
||||||
#: conf/global_settings.py:66
|
#: conf/global_settings.py:68
|
||||||
msgid "Slovak"
|
msgid "Slovak"
|
||||||
msgstr "スロバキア語"
|
msgstr "スロバキア語"
|
||||||
|
|
||||||
#: conf/global_settings.py:67
|
#: conf/global_settings.py:69
|
||||||
msgid "Slovenian"
|
msgid "Slovenian"
|
||||||
msgstr "スロヴェニア語"
|
msgstr "スロヴェニア語"
|
||||||
|
|
||||||
#: conf/global_settings.py:68
|
#: conf/global_settings.py:70
|
||||||
msgid "Serbian"
|
msgid "Serbian"
|
||||||
msgstr "セルビア語"
|
msgstr "セルビア語"
|
||||||
|
|
||||||
#: conf/global_settings.py:69
|
#: conf/global_settings.py:71
|
||||||
msgid "Swedish"
|
msgid "Swedish"
|
||||||
msgstr "スウェーデン語"
|
msgstr "スウェーデン語"
|
||||||
|
|
||||||
#: conf/global_settings.py:70
|
#: conf/global_settings.py:72
|
||||||
msgid "Tamil"
|
msgid "Tamil"
|
||||||
msgstr "タミル語"
|
msgstr "タミル語"
|
||||||
|
|
||||||
#: conf/global_settings.py:71
|
#: conf/global_settings.py:73
|
||||||
|
msgid "Telugu"
|
||||||
|
msgstr "テルグ語"
|
||||||
|
|
||||||
|
#: conf/global_settings.py:74
|
||||||
msgid "Turkish"
|
msgid "Turkish"
|
||||||
msgstr "トルコ語"
|
msgstr "トルコ語"
|
||||||
|
|
||||||
#: conf/global_settings.py:72
|
#: conf/global_settings.py:75
|
||||||
msgid "Ukrainian"
|
msgid "Ukrainian"
|
||||||
msgstr "ウクライナ語"
|
msgstr "ウクライナ語"
|
||||||
|
|
||||||
#: conf/global_settings.py:73
|
#: conf/global_settings.py:76
|
||||||
msgid "Simplified Chinese"
|
msgid "Simplified Chinese"
|
||||||
msgstr "簡体字中国語"
|
msgstr "簡体字中国語"
|
||||||
|
|
||||||
#: conf/global_settings.py:74
|
#: conf/global_settings.py:77
|
||||||
msgid "Traditional Chinese"
|
msgid "Traditional Chinese"
|
||||||
msgstr "繁体字中国語"
|
msgstr "繁体字中国語"
|
||||||
|
|
||||||
@ -194,17 +206,17 @@ msgid "This year"
|
|||||||
msgstr "今年"
|
msgstr "今年"
|
||||||
|
|
||||||
#: contrib/admin/filterspecs.py:143 newforms/widgets.py:170
|
#: contrib/admin/filterspecs.py:143 newforms/widgets.py:170
|
||||||
#: oldforms/__init__.py:572
|
#: oldforms/__init__.py:577
|
||||||
msgid "Yes"
|
msgid "Yes"
|
||||||
msgstr "はい"
|
msgstr "はい"
|
||||||
|
|
||||||
#: contrib/admin/filterspecs.py:143 newforms/widgets.py:170
|
#: contrib/admin/filterspecs.py:143 newforms/widgets.py:170
|
||||||
#: oldforms/__init__.py:572
|
#: oldforms/__init__.py:577
|
||||||
msgid "No"
|
msgid "No"
|
||||||
msgstr "いいえ"
|
msgstr "いいえ"
|
||||||
|
|
||||||
#: contrib/admin/filterspecs.py:150 newforms/widgets.py:170
|
#: contrib/admin/filterspecs.py:150 newforms/widgets.py:170
|
||||||
#: oldforms/__init__.py:572
|
#: oldforms/__init__.py:577
|
||||||
msgid "Unknown"
|
msgid "Unknown"
|
||||||
msgstr "不明"
|
msgstr "不明"
|
||||||
|
|
||||||
@ -568,7 +580,8 @@ msgstr "確認のため、再度パスワードを入力してください。"
|
|||||||
#: contrib/admin/templates/admin/auth/user/change_password.html:28
|
#: contrib/admin/templates/admin/auth/user/change_password.html:28
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Enter a new password for the user <strong>%(username)s</strong>."
|
msgid "Enter a new password for the user <strong>%(username)s</strong>."
|
||||||
msgstr "<strong>%(username)s</strong>さんの新しいパスワードを入力してください。"
|
msgstr ""
|
||||||
|
"<strong>%(username)s</strong>さんの新しいパスワードを入力してください。"
|
||||||
|
|
||||||
#: contrib/admin/templates/admin_doc/bookmarklets.html:3
|
#: contrib/admin/templates/admin_doc/bookmarklets.html:3
|
||||||
msgid "Bookmarklets"
|
msgid "Bookmarklets"
|
||||||
@ -602,7 +615,6 @@ msgstr ""
|
|||||||
msgid "Documentation for this page"
|
msgid "Documentation for this page"
|
||||||
msgstr "このページのドキュメント"
|
msgstr "このページのドキュメント"
|
||||||
|
|
||||||
# TODO
|
|
||||||
#: contrib/admin/templates/admin_doc/bookmarklets.html:20
|
#: contrib/admin/templates/admin_doc/bookmarklets.html:20
|
||||||
msgid ""
|
msgid ""
|
||||||
"Jumps you from any page to the documentation for the view that generates "
|
"Jumps you from any page to the documentation for the view that generates "
|
||||||
@ -769,7 +781,7 @@ msgstr "現在:"
|
|||||||
msgid "Change:"
|
msgid "Change:"
|
||||||
msgstr "変更:"
|
msgstr "変更:"
|
||||||
|
|
||||||
#: contrib/admin/templatetags/admin_list.py:238
|
#: contrib/admin/templatetags/admin_list.py:247
|
||||||
msgid "All dates"
|
msgid "All dates"
|
||||||
msgstr "いつでも"
|
msgstr "いつでも"
|
||||||
|
|
||||||
@ -850,13 +862,13 @@ msgstr "アプリケーション %r が見つかりません"
|
|||||||
|
|
||||||
#: contrib/admin/views/doc.py:171
|
#: contrib/admin/views/doc.py:171
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Model %r not found in app %r"
|
msgid "Model %(name)r not found in app %(label)r"
|
||||||
msgstr "モデル %r が %r アプリケーションに見つかりません"
|
msgstr "モデル %(name)r が %(label)r アプリケーションに見つかりません"
|
||||||
|
|
||||||
#: contrib/admin/views/doc.py:183
|
#: contrib/admin/views/doc.py:183
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "the related `%s.%s` object"
|
msgid "the related `%(label)s.%(type)s` object"
|
||||||
msgstr "`%s.%s` (関連オブジェクト)"
|
msgstr "`%(label)s.%(type)s` (関連オブジェクト)"
|
||||||
|
|
||||||
#: contrib/admin/views/doc.py:183 contrib/admin/views/doc.py:205
|
#: contrib/admin/views/doc.py:183 contrib/admin/views/doc.py:205
|
||||||
#: contrib/admin/views/doc.py:219 contrib/admin/views/doc.py:224
|
#: contrib/admin/views/doc.py:219 contrib/admin/views/doc.py:224
|
||||||
@ -865,8 +877,8 @@ msgstr "モデル :"
|
|||||||
|
|
||||||
#: contrib/admin/views/doc.py:214
|
#: contrib/admin/views/doc.py:214
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "related `%s.%s` objects"
|
msgid "related `%(label)s.%(name)s` objects"
|
||||||
msgstr "`%s.%s` (関連オブジェクト)"
|
msgstr "`%(label)s.%(name)s` (関連オブジェクト)"
|
||||||
|
|
||||||
#: contrib/admin/views/doc.py:219
|
#: contrib/admin/views/doc.py:219
|
||||||
#, python-format
|
#, python-format
|
||||||
@ -984,7 +996,7 @@ msgid "Added %s."
|
|||||||
msgstr "%s を追加しました。"
|
msgstr "%s を追加しました。"
|
||||||
|
|
||||||
#: contrib/admin/views/main.py:335 contrib/admin/views/main.py:337
|
#: contrib/admin/views/main.py:335 contrib/admin/views/main.py:337
|
||||||
#: contrib/admin/views/main.py:339 db/models/manipulators.py:306
|
#: contrib/admin/views/main.py:339 db/models/manipulators.py:308
|
||||||
msgid "and"
|
msgid "and"
|
||||||
msgstr "と"
|
msgstr "と"
|
||||||
|
|
||||||
@ -1018,41 +1030,41 @@ msgstr "%(name)s \"%(obj)s\" を追加しました。続けて編集できます
|
|||||||
msgid "Change %s"
|
msgid "Change %s"
|
||||||
msgstr "%s を変更"
|
msgstr "%s を変更"
|
||||||
|
|
||||||
#: contrib/admin/views/main.py:473
|
#: contrib/admin/views/main.py:476
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "One or more %(fieldname)s in %(name)s: %(obj)s"
|
msgid "One or more %(fieldname)s in %(name)s: %(obj)s"
|
||||||
msgstr "%(name)s に %(fieldname)s が一つ以上あります: %(obj)s"
|
msgstr "%(name)s に %(fieldname)s が一つ以上あります: %(obj)s"
|
||||||
|
|
||||||
#: contrib/admin/views/main.py:478
|
#: contrib/admin/views/main.py:481
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "One or more %(fieldname)s in %(name)s:"
|
msgid "One or more %(fieldname)s in %(name)s:"
|
||||||
msgstr "%(name)s に %(fieldname)s が一つ以上あります:"
|
msgstr "%(name)s に %(fieldname)s が一つ以上あります:"
|
||||||
|
|
||||||
#: contrib/admin/views/main.py:511
|
#: contrib/admin/views/main.py:514
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "The %(name)s \"%(obj)s\" was deleted successfully."
|
msgid "The %(name)s \"%(obj)s\" was deleted successfully."
|
||||||
msgstr "%(name)s \"%(obj)s\" を削除しました。"
|
msgstr "%(name)s \"%(obj)s\" を削除しました。"
|
||||||
|
|
||||||
#: contrib/admin/views/main.py:514
|
#: contrib/admin/views/main.py:517
|
||||||
msgid "Are you sure?"
|
msgid "Are you sure?"
|
||||||
msgstr "よろしいですか?"
|
msgstr "よろしいですか?"
|
||||||
|
|
||||||
#: contrib/admin/views/main.py:536
|
#: contrib/admin/views/main.py:539
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Change history: %s"
|
msgid "Change history: %s"
|
||||||
msgstr "変更履歴: %s"
|
msgstr "変更履歴: %s"
|
||||||
|
|
||||||
#: contrib/admin/views/main.py:570
|
#: contrib/admin/views/main.py:573
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Select %s"
|
msgid "Select %s"
|
||||||
msgstr "%s を選択"
|
msgstr "%s を選択"
|
||||||
|
|
||||||
#: contrib/admin/views/main.py:570
|
#: contrib/admin/views/main.py:573
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Select %s to change"
|
msgid "Select %s to change"
|
||||||
msgstr "変更する %s を選択"
|
msgstr "変更する %s を選択"
|
||||||
|
|
||||||
#: contrib/admin/views/main.py:758
|
#: contrib/admin/views/main.py:768
|
||||||
msgid "Database error"
|
msgid "Database error"
|
||||||
msgstr "データベースエラー"
|
msgstr "データベースエラー"
|
||||||
|
|
||||||
@ -1147,8 +1159,8 @@ msgid ""
|
|||||||
"Use '[algo]$[salt]$[hexdigest]' or use the <a href=\"password/\">change "
|
"Use '[algo]$[salt]$[hexdigest]' or use the <a href=\"password/\">change "
|
||||||
"password form</a>."
|
"password form</a>."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"'[algo]$[salt]$[hexdigest]'形式か、"
|
"'[algo]$[salt]$[hexdigest]'形式か、<a href=\"password/\">パスワード変更フォー"
|
||||||
"<a href=\"password/\">パスワード変更フォーム</a>を使ってください。"
|
"ム</a>を使ってください。"
|
||||||
|
|
||||||
#: contrib/auth/models.py:95
|
#: contrib/auth/models.py:95
|
||||||
msgid "staff status"
|
msgid "staff status"
|
||||||
@ -1517,15 +1529,15 @@ msgstr "コメント ID が不正です"
|
|||||||
msgid "No voting for yourself"
|
msgid "No voting for yourself"
|
||||||
msgstr "自分には投票できません。"
|
msgstr "自分には投票できません。"
|
||||||
|
|
||||||
#: contrib/contenttypes/models.py:26
|
#: contrib/contenttypes/models.py:36
|
||||||
msgid "python model class name"
|
msgid "python model class name"
|
||||||
msgstr "Python モデルクラス名"
|
msgstr "Python モデルクラス名"
|
||||||
|
|
||||||
#: contrib/contenttypes/models.py:29
|
#: contrib/contenttypes/models.py:39
|
||||||
msgid "content type"
|
msgid "content type"
|
||||||
msgstr "コンテンツタイプ"
|
msgstr "コンテンツタイプ"
|
||||||
|
|
||||||
#: contrib/contenttypes/models.py:30
|
#: contrib/contenttypes/models.py:40
|
||||||
msgid "content types"
|
msgid "content types"
|
||||||
msgstr "コンテンツタイプ"
|
msgstr "コンテンツタイプ"
|
||||||
|
|
||||||
@ -1575,7 +1587,281 @@ msgstr "フラットページ"
|
|||||||
msgid "flat pages"
|
msgid "flat pages"
|
||||||
msgstr "フラットページ"
|
msgstr "フラットページ"
|
||||||
|
|
||||||
#: contrib/localflavor/usa/forms.py:13
|
#: contrib/humanize/templatetags/humanize.py:17
|
||||||
|
msgid "th"
|
||||||
|
msgstr "番目"
|
||||||
|
|
||||||
|
#: contrib/humanize/templatetags/humanize.py:17
|
||||||
|
msgid "st"
|
||||||
|
msgstr "番目"
|
||||||
|
|
||||||
|
#: contrib/humanize/templatetags/humanize.py:17
|
||||||
|
msgid "nd"
|
||||||
|
msgstr "番目"
|
||||||
|
|
||||||
|
#: contrib/humanize/templatetags/humanize.py:17
|
||||||
|
msgid "rd"
|
||||||
|
msgstr "番目"
|
||||||
|
|
||||||
|
#: contrib/humanize/templatetags/humanize.py:47
|
||||||
|
#, python-format
|
||||||
|
msgid "%(value).1f million"
|
||||||
|
msgid_plural "%(value).1f million"
|
||||||
|
msgstr[0] "%(value).1f 百万"
|
||||||
|
msgstr[1] "%(value).1f 百万"
|
||||||
|
|
||||||
|
#: contrib/humanize/templatetags/humanize.py:50
|
||||||
|
#, python-format
|
||||||
|
msgid "%(value).1f billion"
|
||||||
|
msgid_plural "%(value).1f billion"
|
||||||
|
msgstr[0] "%(value).1f 十億"
|
||||||
|
msgstr[1] "%(value).1f 十億"
|
||||||
|
|
||||||
|
#: contrib/humanize/templatetags/humanize.py:53
|
||||||
|
#, python-format
|
||||||
|
msgid "%(value).1f trillion"
|
||||||
|
msgid_plural "%(value).1f trillion"
|
||||||
|
msgstr[0] "%(value).1f 兆"
|
||||||
|
msgstr[1] "%(value).1f 兆"
|
||||||
|
|
||||||
|
#: contrib/humanize/templatetags/humanize.py:68
|
||||||
|
msgid "one"
|
||||||
|
msgstr "1"
|
||||||
|
|
||||||
|
#: contrib/humanize/templatetags/humanize.py:68
|
||||||
|
msgid "two"
|
||||||
|
msgstr "2"
|
||||||
|
|
||||||
|
#: contrib/humanize/templatetags/humanize.py:68
|
||||||
|
msgid "three"
|
||||||
|
msgstr "3"
|
||||||
|
|
||||||
|
#: contrib/humanize/templatetags/humanize.py:68
|
||||||
|
msgid "four"
|
||||||
|
msgstr "4"
|
||||||
|
|
||||||
|
#: contrib/humanize/templatetags/humanize.py:68
|
||||||
|
msgid "five"
|
||||||
|
msgstr "5"
|
||||||
|
|
||||||
|
#: contrib/humanize/templatetags/humanize.py:68
|
||||||
|
msgid "six"
|
||||||
|
msgstr "6"
|
||||||
|
|
||||||
|
#: contrib/humanize/templatetags/humanize.py:68
|
||||||
|
msgid "seven"
|
||||||
|
msgstr "7"
|
||||||
|
|
||||||
|
#: contrib/humanize/templatetags/humanize.py:68
|
||||||
|
msgid "eight"
|
||||||
|
msgstr "8"
|
||||||
|
|
||||||
|
#: contrib/humanize/templatetags/humanize.py:68
|
||||||
|
msgid "nine"
|
||||||
|
msgstr "9"
|
||||||
|
|
||||||
|
#: contrib/localflavor/fr/forms.py:17
|
||||||
|
#, fuzzy
|
||||||
|
msgid "Enter a zip code in the format XXXXX."
|
||||||
|
msgstr "XXXXXの形式でZipコードを入力してください。"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/forms.py:21
|
||||||
|
msgid "Enter a postal code in the format XXXXXXX or XXX-XXXX."
|
||||||
|
msgstr "XXXXXか、XXXXX-XXXXの形式で郵便番号を入力してください。"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:4
|
||||||
|
msgid "Hokkaido"
|
||||||
|
msgstr "北海道"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:5
|
||||||
|
msgid "Aomori"
|
||||||
|
msgstr "青森県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:6
|
||||||
|
msgid "Iwate"
|
||||||
|
msgstr "岩手県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:7
|
||||||
|
msgid "Miyagi"
|
||||||
|
msgstr "宮城県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:8
|
||||||
|
msgid "Akita"
|
||||||
|
msgstr "秋田県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:9
|
||||||
|
msgid "Yamagata"
|
||||||
|
msgstr "山形県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:10
|
||||||
|
msgid "Fukushima"
|
||||||
|
msgstr "福島県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:11
|
||||||
|
msgid "Ibaraki"
|
||||||
|
msgstr "茨城県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:12
|
||||||
|
msgid "Tochigi"
|
||||||
|
msgstr "栃木県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:13
|
||||||
|
msgid "Gunma"
|
||||||
|
msgstr "群馬県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:14
|
||||||
|
msgid "Saitama"
|
||||||
|
msgstr "埼玉県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:15
|
||||||
|
msgid "Chiba"
|
||||||
|
msgstr "千葉県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:16
|
||||||
|
msgid "Tokyo"
|
||||||
|
msgstr "東京都"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:17
|
||||||
|
msgid "Kanagawa"
|
||||||
|
msgstr "神奈川県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:18
|
||||||
|
msgid "Yamanashi"
|
||||||
|
msgstr "山梨県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:19
|
||||||
|
msgid "Nagano"
|
||||||
|
msgstr "長野県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:20
|
||||||
|
msgid "Niigata"
|
||||||
|
msgstr "新潟県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:21
|
||||||
|
msgid "Toyama"
|
||||||
|
msgstr "富山県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:22
|
||||||
|
msgid "Ishikawa"
|
||||||
|
msgstr "石川県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:23
|
||||||
|
msgid "Fukui"
|
||||||
|
msgstr "福井県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:24
|
||||||
|
msgid "Gifu"
|
||||||
|
msgstr "岐阜県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:25
|
||||||
|
msgid "Shizuoka"
|
||||||
|
msgstr "静岡県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:26
|
||||||
|
msgid "Aichi"
|
||||||
|
msgstr "愛知県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:27
|
||||||
|
msgid "Mie"
|
||||||
|
msgstr "三重県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:28
|
||||||
|
msgid "Shiga"
|
||||||
|
msgstr "滋賀県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:29
|
||||||
|
msgid "Kyoto"
|
||||||
|
msgstr "京都府"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:30
|
||||||
|
msgid "Osaka"
|
||||||
|
msgstr "大阪府"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:31
|
||||||
|
msgid "Hyogo"
|
||||||
|
msgstr "兵庫県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:32
|
||||||
|
msgid "Nara"
|
||||||
|
msgstr "奈良県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:33
|
||||||
|
msgid "Wakayama"
|
||||||
|
msgstr "和歌山県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:34
|
||||||
|
msgid "Tottori"
|
||||||
|
msgstr "鳥取県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:35
|
||||||
|
msgid "Shimane"
|
||||||
|
msgstr "島根県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:36
|
||||||
|
msgid "Okayama"
|
||||||
|
msgstr "岡山県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:37
|
||||||
|
msgid "Hiroshima"
|
||||||
|
msgstr "広島県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:38
|
||||||
|
msgid "Yamaguchi"
|
||||||
|
msgstr "山口県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:39
|
||||||
|
msgid "Tokushima"
|
||||||
|
msgstr "徳島県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:40
|
||||||
|
msgid "Kagawa"
|
||||||
|
msgstr "香川県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:41
|
||||||
|
msgid "Ehime"
|
||||||
|
msgstr "愛媛県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:42
|
||||||
|
msgid "Kochi"
|
||||||
|
msgstr "高知県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:43
|
||||||
|
msgid "Fukuoka"
|
||||||
|
msgstr "福岡県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:44
|
||||||
|
msgid "Saga"
|
||||||
|
msgstr "佐賀県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:45
|
||||||
|
msgid "Nagasaki"
|
||||||
|
msgstr "長崎県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:46
|
||||||
|
msgid "Kumamoto"
|
||||||
|
msgstr "熊本県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:47
|
||||||
|
msgid "Oita"
|
||||||
|
msgstr "大分県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:48
|
||||||
|
msgid "Miyazaki"
|
||||||
|
msgstr "宮崎県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:49
|
||||||
|
msgid "Kagoshima"
|
||||||
|
msgstr "鹿児島県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/jp/jp_prefectures.py:50
|
||||||
|
msgid "Okinawa"
|
||||||
|
msgstr "沖縄県"
|
||||||
|
|
||||||
|
#: contrib/localflavor/uk/forms.py:18
|
||||||
|
msgid "Enter a postcode. A space is required between the two postcode parts."
|
||||||
|
msgstr "ポスタルコードを入力してください。コードとコードの間は半角のスペースで区切ってください。"
|
||||||
|
|
||||||
|
#: contrib/localflavor/usa/forms.py:17
|
||||||
msgid "Enter a zip code in the format XXXXX or XXXXX-XXXX."
|
msgid "Enter a zip code in the format XXXXX or XXXXX-XXXX."
|
||||||
msgstr "XXXXXか、XXXXX-XXXXの形式で郵便番号を入力してください。"
|
msgstr "XXXXXか、XXXXX-XXXXの形式で郵便番号を入力してください。"
|
||||||
|
|
||||||
@ -1607,23 +1893,23 @@ msgstr "リダイレクト"
|
|||||||
msgid "redirects"
|
msgid "redirects"
|
||||||
msgstr "リダイレクト"
|
msgstr "リダイレクト"
|
||||||
|
|
||||||
#: contrib/sessions/models.py:51
|
#: contrib/sessions/models.py:68
|
||||||
msgid "session key"
|
msgid "session key"
|
||||||
msgstr "セッションキー"
|
msgstr "セッションキー"
|
||||||
|
|
||||||
#: contrib/sessions/models.py:52
|
#: contrib/sessions/models.py:69
|
||||||
msgid "session data"
|
msgid "session data"
|
||||||
msgstr "セッションデータ"
|
msgstr "セッションデータ"
|
||||||
|
|
||||||
#: contrib/sessions/models.py:53
|
#: contrib/sessions/models.py:70
|
||||||
msgid "expire date"
|
msgid "expire date"
|
||||||
msgstr "有効期限"
|
msgstr "有効期限"
|
||||||
|
|
||||||
#: contrib/sessions/models.py:57
|
#: contrib/sessions/models.py:74
|
||||||
msgid "session"
|
msgid "session"
|
||||||
msgstr "セッション"
|
msgstr "セッション"
|
||||||
|
|
||||||
#: contrib/sessions/models.py:58
|
#: contrib/sessions/models.py:75
|
||||||
msgid "sessions"
|
msgid "sessions"
|
||||||
msgstr "セッション"
|
msgstr "セッション"
|
||||||
|
|
||||||
@ -1704,31 +1990,31 @@ msgstr "1900年以降を指定してください。"
|
|||||||
|
|
||||||
#: core/validators.py:143
|
#: core/validators.py:143
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Invalid date: %s."
|
msgid "Invalid date: %s"
|
||||||
msgstr "無効な日付: %s"
|
msgstr "無効な日付: %s"
|
||||||
|
|
||||||
#: core/validators.py:147 db/models/fields/__init__.py:454
|
#: core/validators.py:148 db/models/fields/__init__.py:457
|
||||||
msgid "Enter a valid date in YYYY-MM-DD format."
|
msgid "Enter a valid date in YYYY-MM-DD format."
|
||||||
msgstr "YYYY-MM-DD形式で日付を入力してください。"
|
msgstr "YYYY-MM-DD形式で日付を入力してください。"
|
||||||
|
|
||||||
#: core/validators.py:152
|
#: core/validators.py:153
|
||||||
msgid "Enter a valid time in HH:MM format."
|
msgid "Enter a valid time in HH:MM format."
|
||||||
msgstr "HH:MM形式で時刻を入力してください。"
|
msgstr "HH:MM形式で時刻を入力してください。"
|
||||||
|
|
||||||
#: core/validators.py:156 db/models/fields/__init__.py:521
|
#: core/validators.py:157 db/models/fields/__init__.py:526
|
||||||
msgid "Enter a valid date/time in YYYY-MM-DD HH:MM format."
|
msgid "Enter a valid date/time in YYYY-MM-DD HH:MM format."
|
||||||
msgstr "YYYY-MM-DD HH:MM形式で日時を入力してください。"
|
msgstr "YYYY-MM-DD HH:MM形式で日時を入力してください。"
|
||||||
|
|
||||||
#: core/validators.py:161 newforms/fields.py:269
|
#: core/validators.py:162 newforms/fields.py:269
|
||||||
msgid "Enter a valid e-mail address."
|
msgid "Enter a valid e-mail address."
|
||||||
msgstr "有効なメールアドレスを入力してください。"
|
msgstr "有効なメールアドレスを入力してください。"
|
||||||
|
|
||||||
#: core/validators.py:173 core/validators.py:442 oldforms/__init__.py:667
|
#: core/validators.py:174 core/validators.py:445 oldforms/__init__.py:672
|
||||||
msgid "No file was submitted. Check the encoding type on the form."
|
msgid "No file was submitted. Check the encoding type on the form."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"ファイルが取得できませんでした。formのencoding typeを確認してください。"
|
"ファイルが取得できませんでした。formのencoding typeを確認してください。"
|
||||||
|
|
||||||
#: core/validators.py:177
|
#: core/validators.py:178
|
||||||
msgid ""
|
msgid ""
|
||||||
"Upload a valid image. The file you uploaded was either not an image or a "
|
"Upload a valid image. The file you uploaded was either not an image or a "
|
||||||
"corrupted image."
|
"corrupted image."
|
||||||
@ -1736,26 +2022,26 @@ msgstr ""
|
|||||||
"画像をアップロードしてください。アップロードした画像は画像でないか、または壊"
|
"画像をアップロードしてください。アップロードした画像は画像でないか、または壊"
|
||||||
"れています。"
|
"れています。"
|
||||||
|
|
||||||
#: core/validators.py:184
|
#: core/validators.py:185
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "The URL %s does not point to a valid image."
|
msgid "The URL %s does not point to a valid image."
|
||||||
msgstr "URL ( %s ) は画像ではありません。"
|
msgstr "URL ( %s ) は画像ではありません。"
|
||||||
|
|
||||||
#: core/validators.py:188
|
#: core/validators.py:189
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Phone numbers must be in XXX-XXX-XXXX format. \"%s\" is invalid."
|
msgid "Phone numbers must be in XXX-XXX-XXXX format. \"%s\" is invalid."
|
||||||
msgstr "電話番号は XXX-XXX-XXXX 形式で入力してください。\"%s\" は無効です。"
|
msgstr "電話番号は XXX-XXX-XXXX 形式で入力してください。\"%s\" は無効です。"
|
||||||
|
|
||||||
#: core/validators.py:196
|
#: core/validators.py:197
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "The URL %s does not point to a valid QuickTime video."
|
msgid "The URL %s does not point to a valid QuickTime video."
|
||||||
msgstr "URL ( %s ) は QuickTime ビデオではありません。"
|
msgstr "URL ( %s ) は QuickTime ビデオではありません。"
|
||||||
|
|
||||||
#: core/validators.py:200
|
#: core/validators.py:201
|
||||||
msgid "A valid URL is required."
|
msgid "A valid URL is required."
|
||||||
msgstr "正しい URL を入力してください。"
|
msgstr "正しい URL を入力してください。"
|
||||||
|
|
||||||
#: core/validators.py:214
|
#: core/validators.py:215
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"Valid HTML is required. Specific errors are:\n"
|
"Valid HTML is required. Specific errors are:\n"
|
||||||
@ -1764,86 +2050,86 @@ msgstr ""
|
|||||||
"有効な HTML を入力してください。エラー:\n"
|
"有効な HTML を入力してください。エラー:\n"
|
||||||
"%s"
|
"%s"
|
||||||
|
|
||||||
#: core/validators.py:221
|
#: core/validators.py:222
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Badly formed XML: %s"
|
msgid "Badly formed XML: %s"
|
||||||
msgstr "不正な XML です: %s"
|
msgstr "不正な XML です: %s"
|
||||||
|
|
||||||
#: core/validators.py:238
|
#: core/validators.py:239
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Invalid URL: %s"
|
msgid "Invalid URL: %s"
|
||||||
msgstr "無効なURL: %s"
|
msgstr "無効なURL: %s"
|
||||||
|
|
||||||
#: core/validators.py:243 core/validators.py:245
|
#: core/validators.py:244 core/validators.py:246
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "The URL %s is a broken link."
|
msgid "The URL %s is a broken link."
|
||||||
msgstr "URL ( %s ) はリンクが壊れています。"
|
msgstr "URL ( %s ) はリンクが壊れています。"
|
||||||
|
|
||||||
#: core/validators.py:251
|
#: core/validators.py:252
|
||||||
msgid "Enter a valid U.S. state abbreviation."
|
msgid "Enter a valid U.S. state abbreviation."
|
||||||
msgstr "正しい米州略称を入力してください。"
|
msgstr "正しい米州略称を入力してください。"
|
||||||
|
|
||||||
#: core/validators.py:265
|
#: core/validators.py:266
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Watch your mouth! The word %s is not allowed here."
|
msgid "Watch your mouth! The word %s is not allowed here."
|
||||||
msgid_plural "Watch your mouth! The words %s are not allowed here."
|
msgid_plural "Watch your mouth! The words %s are not allowed here."
|
||||||
msgstr[0] "言葉使いに気を付けて! %s という言葉は使えません。"
|
msgstr[0] "言葉使いに気を付けて! %s という言葉は使えません。"
|
||||||
msgstr[1] "言葉使いに気を付けて! %s という言葉は使えません。"
|
msgstr[1] "言葉使いに気を付けて! %s という言葉は使えません。"
|
||||||
|
|
||||||
#: core/validators.py:272
|
#: core/validators.py:273
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "This field must match the '%s' field."
|
msgid "This field must match the '%s' field."
|
||||||
msgstr "このフィールドは '%s' フィールドと一致せねばなりません。"
|
msgstr "このフィールドは '%s' フィールドと一致せねばなりません。"
|
||||||
|
|
||||||
#: core/validators.py:291
|
#: core/validators.py:292
|
||||||
msgid "Please enter something for at least one field."
|
msgid "Please enter something for at least one field."
|
||||||
msgstr "少なくとも一つのフィールドに何か入力してください。"
|
msgstr "少なくとも一つのフィールドに何か入力してください。"
|
||||||
|
|
||||||
#: core/validators.py:300 core/validators.py:311
|
#: core/validators.py:301 core/validators.py:312
|
||||||
msgid "Please enter both fields or leave them both empty."
|
msgid "Please enter both fields or leave them both empty."
|
||||||
msgstr "両方のフィールドに入力するか、両方とも未入力にしてください。"
|
msgstr "両方のフィールドに入力するか、両方とも未入力にしてください。"
|
||||||
|
|
||||||
#: core/validators.py:318
|
#: core/validators.py:320
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "This field must be given if %(field)s is %(value)s"
|
msgid "This field must be given if %(field)s is %(value)s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"%(field)s を %(value)s にするのなら、このフィールドに必ず入力してください。"
|
"%(field)s を %(value)s にするのなら、このフィールドに必ず入力してください。"
|
||||||
|
|
||||||
#: core/validators.py:330
|
#: core/validators.py:333
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "This field must be given if %(field)s is not %(value)s"
|
msgid "This field must be given if %(field)s is not %(value)s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"%(field)s を %(value)s にしないのなら、このフィールドに必ず入力してください。"
|
"%(field)s を %(value)s にしないのなら、このフィールドに必ず入力してください。"
|
||||||
|
|
||||||
#: core/validators.py:349
|
#: core/validators.py:352
|
||||||
msgid "Duplicate values are not allowed."
|
msgid "Duplicate values are not allowed."
|
||||||
msgstr "重複する値は認められません。"
|
msgstr "重複する値は認められません。"
|
||||||
|
|
||||||
#: core/validators.py:364
|
#: core/validators.py:367
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "This value must be between %s and %s."
|
msgid "This value must be between %(lower)s and %(upper)s."
|
||||||
msgstr "この値は %s から %s の間でなければなりません。"
|
msgstr "この値は %(lower)s から %(upper)s の間でなければなりません。"
|
||||||
|
|
||||||
#: core/validators.py:366
|
#: core/validators.py:369
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "This value must be at least %s."
|
msgid "This value must be at least %s."
|
||||||
msgstr "この値は %s 以上でなければなりません。"
|
msgstr "この値は %s 以上でなければなりません。"
|
||||||
|
|
||||||
#: core/validators.py:368
|
#: core/validators.py:371
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "This value must be no more than %s."
|
msgid "This value must be no more than %s."
|
||||||
msgstr "この値は %s より小さくなければなりません。"
|
msgstr "この値は %s より小さくなければなりません。"
|
||||||
|
|
||||||
#: core/validators.py:404
|
#: core/validators.py:407
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "This value must be a power of %s."
|
msgid "This value must be a power of %s."
|
||||||
msgstr "この値は %s の累乗でなければなりません。"
|
msgstr "この値は %s の累乗でなければなりません。"
|
||||||
|
|
||||||
#: core/validators.py:415
|
#: core/validators.py:418
|
||||||
msgid "Please enter a valid decimal number."
|
msgid "Please enter a valid decimal number."
|
||||||
msgstr "有効な 10 進数を入力してください。"
|
msgstr "有効な 10 進数を入力してください。"
|
||||||
|
|
||||||
#: core/validators.py:419
|
#: core/validators.py:422
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Please enter a valid decimal number with at most %s total digit."
|
msgid "Please enter a valid decimal number with at most %s total digit."
|
||||||
msgid_plural ""
|
msgid_plural ""
|
||||||
@ -1851,7 +2137,7 @@ msgid_plural ""
|
|||||||
msgstr[0] "全体で %s 文字以下の数字を入力してください。"
|
msgstr[0] "全体で %s 文字以下の数字を入力してください。"
|
||||||
msgstr[1] "全体で %s 文字以下の数字を入力してください。"
|
msgstr[1] "全体で %s 文字以下の数字を入力してください。"
|
||||||
|
|
||||||
#: core/validators.py:422
|
#: core/validators.py:425
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"Please enter a valid decimal number with a whole part of at most %s digit."
|
"Please enter a valid decimal number with a whole part of at most %s digit."
|
||||||
@ -1860,7 +2146,7 @@ msgid_plural ""
|
|||||||
msgstr[0] "整数部は %s 文字以下の数字を入力してください。"
|
msgstr[0] "整数部は %s 文字以下の数字を入力してください。"
|
||||||
msgstr[1] "整数部は %s 文字以下の数字を入力してください。"
|
msgstr[1] "整数部は %s 文字以下の数字を入力してください。"
|
||||||
|
|
||||||
#: core/validators.py:425
|
#: core/validators.py:428
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Please enter a valid decimal number with at most %s decimal place."
|
msgid "Please enter a valid decimal number with at most %s decimal place."
|
||||||
msgid_plural ""
|
msgid_plural ""
|
||||||
@ -1868,37 +2154,37 @@ msgid_plural ""
|
|||||||
msgstr[0] "小数部は %s 文字以下の数字を入力してください。"
|
msgstr[0] "小数部は %s 文字以下の数字を入力してください。"
|
||||||
msgstr[1] "小数部は %s 文字以下の数字を入力してください。"
|
msgstr[1] "小数部は %s 文字以下の数字を入力してください。"
|
||||||
|
|
||||||
#: core/validators.py:435
|
#: core/validators.py:438
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Make sure your uploaded file is at least %s bytes big."
|
msgid "Make sure your uploaded file is at least %s bytes big."
|
||||||
msgstr "アップロードするファイルの大きさは %s バイト以上にしてください。"
|
msgstr "アップロードするファイルの大きさは %s バイト以上にしてください。"
|
||||||
|
|
||||||
#: core/validators.py:436
|
#: core/validators.py:439
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Make sure your uploaded file is at most %s bytes big."
|
msgid "Make sure your uploaded file is at most %s bytes big."
|
||||||
msgstr "アップロードするファイルの大きさは %s 最大バイトまでです。"
|
msgstr "アップロードするファイルの大きさは %s 最大バイトまでです。"
|
||||||
|
|
||||||
#: core/validators.py:453
|
#: core/validators.py:456
|
||||||
msgid "The format for this field is wrong."
|
msgid "The format for this field is wrong."
|
||||||
msgstr "フィールドの形式が正しくありません。"
|
msgstr "フィールドの形式が正しくありません。"
|
||||||
|
|
||||||
#: core/validators.py:468
|
#: core/validators.py:471
|
||||||
msgid "This field is invalid."
|
msgid "This field is invalid."
|
||||||
msgstr "このフィールドは無効です。"
|
msgstr "このフィールドは無効です。"
|
||||||
|
|
||||||
#: core/validators.py:504
|
#: core/validators.py:507
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Could not retrieve anything from %s."
|
msgid "Could not retrieve anything from %s."
|
||||||
msgstr "%s から何も検索できませんでした。"
|
msgstr "%s から何も検索できませんでした。"
|
||||||
|
|
||||||
#: core/validators.py:507
|
#: core/validators.py:510
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"The URL %(url)s returned the invalid Content-Type header '%(contenttype)s'."
|
"The URL %(url)s returned the invalid Content-Type header '%(contenttype)s'."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"URL %(url)s は無効なコンテンツタイプヘッダ '%(contenttype)s' を返しました。"
|
"URL %(url)s は無効なコンテンツタイプヘッダ '%(contenttype)s' を返しました。"
|
||||||
|
|
||||||
#: core/validators.py:540
|
#: core/validators.py:543
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"Please close the unclosed %(tag)s tag from line %(line)s. (Line starts with "
|
"Please close the unclosed %(tag)s tag from line %(line)s. (Line starts with "
|
||||||
@ -1907,7 +2193,7 @@ msgstr ""
|
|||||||
"%(line)s 行目から始まる %(tag)s タグを閉じてください (\"%(start)s\" で始まる"
|
"%(line)s 行目から始まる %(tag)s タグを閉じてください (\"%(start)s\" で始まる"
|
||||||
"行です)。"
|
"行です)。"
|
||||||
|
|
||||||
#: core/validators.py:544
|
#: core/validators.py:547
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"Some text starting on line %(line)s is not allowed in that context. (Line "
|
"Some text starting on line %(line)s is not allowed in that context. (Line "
|
||||||
@ -1916,7 +2202,7 @@ msgstr ""
|
|||||||
"%(line)s 行目から始まるテキストはこのコンテキストでは使えません。 (\"%(start)"
|
"%(line)s 行目から始まるテキストはこのコンテキストでは使えません。 (\"%(start)"
|
||||||
"s\" で始まる行です)。"
|
"s\" で始まる行です)。"
|
||||||
|
|
||||||
#: core/validators.py:549
|
#: core/validators.py:552
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"\"%(attr)s\" on line %(line)s is an invalid attribute. (Line starts with \"%"
|
"\"%(attr)s\" on line %(line)s is an invalid attribute. (Line starts with \"%"
|
||||||
@ -1925,7 +2211,7 @@ msgstr ""
|
|||||||
"%(line)s 行目の \"%(attr)s\" は無効なアトリビュートです (\"%(start)s\" で始ま"
|
"%(line)s 行目の \"%(attr)s\" は無効なアトリビュートです (\"%(start)s\" で始ま"
|
||||||
"る行です)。"
|
"る行です)。"
|
||||||
|
|
||||||
#: core/validators.py:554
|
#: core/validators.py:557
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"\"<%(tag)s>\" on line %(line)s is an invalid tag. (Line starts with \"%"
|
"\"<%(tag)s>\" on line %(line)s is an invalid tag. (Line starts with \"%"
|
||||||
@ -1934,7 +2220,7 @@ msgstr ""
|
|||||||
"%(line)s 行目の \"<%(tag)s>\" は無効なタグです( \"%(start)s\" で始まる行で"
|
"%(line)s 行目の \"<%(tag)s>\" は無効なタグです( \"%(start)s\" で始まる行で"
|
||||||
"す)。"
|
"す)。"
|
||||||
|
|
||||||
#: core/validators.py:558
|
#: core/validators.py:561
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"A tag on line %(line)s is missing one or more required attributes. (Line "
|
"A tag on line %(line)s is missing one or more required attributes. (Line "
|
||||||
@ -1943,7 +2229,7 @@ msgstr ""
|
|||||||
"%(line)s 行目のタグは必須アトリビュートが未入力です( \"%(start)s\" で始まる行"
|
"%(line)s 行目のタグは必須アトリビュートが未入力です( \"%(start)s\" で始まる行"
|
||||||
"です)。"
|
"です)。"
|
||||||
|
|
||||||
#: core/validators.py:563
|
#: core/validators.py:566
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"The \"%(attr)s\" attribute on line %(line)s has an invalid value. (Line "
|
"The \"%(attr)s\" attribute on line %(line)s has an invalid value. (Line "
|
||||||
@ -1952,7 +2238,7 @@ msgstr ""
|
|||||||
"%(line)s 行目の \"%(attr)s\" アトリビュートの値が正しくありません (\"%(start)"
|
"%(line)s 行目の \"%(attr)s\" アトリビュートの値が正しくありません (\"%(start)"
|
||||||
"s\" で始まる行です) 。"
|
"s\" で始まる行です) 。"
|
||||||
|
|
||||||
#: db/models/manipulators.py:305
|
#: db/models/manipulators.py:307
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "%(object)s with this %(type)s already exists for the given %(field)s."
|
msgid "%(object)s with this %(type)s already exists for the given %(field)s."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -1963,29 +2249,33 @@ msgstr ""
|
|||||||
msgid "%(optname)s with this %(fieldname)s already exists."
|
msgid "%(optname)s with this %(fieldname)s already exists."
|
||||||
msgstr "%(fieldname)s に %(optname)s は既に存在します。"
|
msgstr "%(fieldname)s に %(optname)s は既に存在します。"
|
||||||
|
|
||||||
#: db/models/fields/__init__.py:116 db/models/fields/__init__.py:273
|
#: db/models/fields/__init__.py:117 db/models/fields/__init__.py:274
|
||||||
#: db/models/fields/__init__.py:605 db/models/fields/__init__.py:616
|
#: db/models/fields/__init__.py:610 db/models/fields/__init__.py:621
|
||||||
#: newforms/fields.py:78 newforms/fields.py:373 newforms/fields.py:449
|
#: newforms/fields.py:78 newforms/fields.py:374 newforms/fields.py:450
|
||||||
#: newforms/fields.py:460 oldforms/__init__.py:352
|
#: newforms/fields.py:461 newforms/models.py:177 oldforms/__init__.py:357
|
||||||
msgid "This field is required."
|
msgid "This field is required."
|
||||||
msgstr "このフィールドは必須です。"
|
msgstr "このフィールドは必須です。"
|
||||||
|
|
||||||
#: db/models/fields/__init__.py:366
|
#: db/models/fields/__init__.py:367
|
||||||
msgid "This value must be an integer."
|
msgid "This value must be an integer."
|
||||||
msgstr "値は整数でなければなりません。"
|
msgstr "値は整数でなければなりません。"
|
||||||
|
|
||||||
#: db/models/fields/__init__.py:401
|
#: db/models/fields/__init__.py:402
|
||||||
msgid "This value must be either True or False."
|
msgid "This value must be either True or False."
|
||||||
msgstr "値は真: True または偽: False でなければなりません。"
|
msgstr "値は真: True または偽: False でなければなりません。"
|
||||||
|
|
||||||
#: db/models/fields/__init__.py:422
|
#: db/models/fields/__init__.py:423
|
||||||
msgid "This field cannot be null."
|
msgid "This field cannot be null."
|
||||||
msgstr "このフィールドには NULL を指定できません。"
|
msgstr "このフィールドには NULL を指定できません。"
|
||||||
|
|
||||||
#: db/models/fields/__init__.py:625
|
#: db/models/fields/__init__.py:630
|
||||||
msgid "Enter a valid filename."
|
msgid "Enter a valid filename."
|
||||||
msgstr "正しいファイル名を入力してください。"
|
msgstr "正しいファイル名を入力してください。"
|
||||||
|
|
||||||
|
#: db/models/fields/__init__.py:751
|
||||||
|
msgid "This value must be either None, True or False."
|
||||||
|
msgstr "値は、空: None、真: True または偽: False でなければなりません。"
|
||||||
|
|
||||||
#: db/models/fields/related.py:53
|
#: db/models/fields/related.py:53
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Please enter a valid %s."
|
msgid "Please enter a valid %s."
|
||||||
@ -2054,55 +2344,79 @@ msgstr "URLを正しく入力してください。"
|
|||||||
msgid "This URL appears to be a broken link."
|
msgid "This URL appears to be a broken link."
|
||||||
msgstr "このURLはリンクが壊れています。"
|
msgstr "このURLはリンクが壊れています。"
|
||||||
|
|
||||||
#: newforms/fields.py:359
|
#: newforms/fields.py:360 newforms/models.py:164
|
||||||
msgid "Select a valid choice. That choice is not one of the available choices."
|
msgid "Select a valid choice. That choice is not one of the available choices."
|
||||||
msgstr "正しく選択してください。選択したものは候補にありません。"
|
msgstr "正しく選択してください。選択したものは候補にありません。"
|
||||||
|
|
||||||
#: newforms/fields.py:377 newforms/fields.py:453
|
#: newforms/fields.py:378 newforms/fields.py:454 newforms/models.py:181
|
||||||
msgid "Enter a list of values."
|
msgid "Enter a list of values."
|
||||||
msgstr "リストを入力してください。"
|
msgstr "リストを入力してください。"
|
||||||
|
|
||||||
#: newforms/fields.py:386
|
#: newforms/fields.py:387 newforms/models.py:187
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Select a valid choice. %s is not one of the available choices."
|
msgid "Select a valid choice. %s is not one of the available choices."
|
||||||
msgstr "正しく選択してください。 %s は候補にありません。"
|
msgstr "正しく選択してください。 %s は候補にありません。"
|
||||||
|
|
||||||
#: oldforms/__init__.py:387
|
#: oldforms/__init__.py:392
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Ensure your text is less than %s character."
|
msgid "Ensure your text is less than %s character."
|
||||||
msgid_plural "Ensure your text is less than %s characters."
|
msgid_plural "Ensure your text is less than %s characters."
|
||||||
msgstr[0] "%s 字以下で入力してください。"
|
msgstr[0] "%s 字以下で入力してください。"
|
||||||
msgstr[1] "%s 字以下で入力してください。"
|
msgstr[1] "%s 字以下で入力してください。"
|
||||||
|
|
||||||
#: oldforms/__init__.py:392
|
#: oldforms/__init__.py:397
|
||||||
msgid "Line breaks are not allowed here."
|
msgid "Line breaks are not allowed here."
|
||||||
msgstr "改行はできません。"
|
msgstr "改行はできません。"
|
||||||
|
|
||||||
#: oldforms/__init__.py:493 oldforms/__init__.py:566 oldforms/__init__.py:605
|
#: oldforms/__init__.py:498 oldforms/__init__.py:571 oldforms/__init__.py:610
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Select a valid choice; '%(data)s' is not in %(choices)s."
|
msgid "Select a valid choice; '%(data)s' is not in %(choices)s."
|
||||||
msgstr "正しく選択してください。; '%(data)s' は %(choices)s にありません。"
|
msgstr "正しく選択してください。; '%(data)s' は %(choices)s にありません。"
|
||||||
|
|
||||||
#: oldforms/__init__.py:669
|
#: oldforms/__init__.py:674
|
||||||
msgid "The submitted file is empty."
|
msgid "The submitted file is empty."
|
||||||
msgstr "入力されたファイルは空です。"
|
msgstr "入力されたファイルは空です。"
|
||||||
|
|
||||||
#: oldforms/__init__.py:725
|
#: oldforms/__init__.py:730
|
||||||
msgid "Enter a whole number between -32,768 and 32,767."
|
msgid "Enter a whole number between -32,768 and 32,767."
|
||||||
msgstr "-32,768 から 32,767 までの整数を入力してください。"
|
msgstr "-32,768 から 32,767 までの整数を入力してください。"
|
||||||
|
|
||||||
#: oldforms/__init__.py:735
|
#: oldforms/__init__.py:740
|
||||||
msgid "Enter a positive number."
|
msgid "Enter a positive number."
|
||||||
msgstr "正の数を入力してください。"
|
msgstr "正の数を入力してください。"
|
||||||
|
|
||||||
#: oldforms/__init__.py:745
|
#: oldforms/__init__.py:750
|
||||||
msgid "Enter a whole number between 0 and 32,767."
|
msgid "Enter a whole number between 0 and 32,767."
|
||||||
msgstr "0 から 32,767 までの整数を入力してください。"
|
msgstr "0 から 32,767 までの整数を入力してください。"
|
||||||
|
|
||||||
#: template/defaultfilters.py:436
|
#: template/defaultfilters.py:491
|
||||||
msgid "yes,no,maybe"
|
msgid "yes,no,maybe"
|
||||||
msgstr "はい,いいえ,たぶん"
|
msgstr "はい,いいえ,たぶん"
|
||||||
|
|
||||||
|
#: utils/dateformat.py:40
|
||||||
|
msgid "p.m."
|
||||||
|
msgstr "p.m."
|
||||||
|
|
||||||
|
#: utils/dateformat.py:41
|
||||||
|
msgid "a.m."
|
||||||
|
msgstr "a.m."
|
||||||
|
|
||||||
|
#: utils/dateformat.py:46
|
||||||
|
msgid "PM"
|
||||||
|
msgstr "PM"
|
||||||
|
|
||||||
|
#: utils/dateformat.py:47
|
||||||
|
msgid "AM"
|
||||||
|
msgstr "AM"
|
||||||
|
|
||||||
|
#: utils/dateformat.py:95
|
||||||
|
msgid "midnight"
|
||||||
|
msgstr "0時"
|
||||||
|
|
||||||
|
#: utils/dateformat.py:97
|
||||||
|
msgid "noon"
|
||||||
|
msgstr "12時"
|
||||||
|
|
||||||
#: utils/dates.py:6
|
#: utils/dates.py:6
|
||||||
msgid "Monday"
|
msgid "Monday"
|
||||||
msgstr "月曜日"
|
msgstr "月曜日"
|
||||||
|
Binary file not shown.
@ -1,14 +1,12 @@
|
|||||||
# SOME DESCRIPTIVE TITLE.
|
# Japanese translation for js.
|
||||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
# Copyright (C) 2005 makoto tsuyuki
|
||||||
# This file is distributed under the same license as the PACKAGE package.
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
# makoto tsuyuki <mtsuyuki@gmail.com>, 2005.
|
||||||
#
|
|
||||||
#, fuzzy
|
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Django 1.0\n"
|
"Project-Id-Version: Django 1.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2006-10-06 00:30+0900\n"
|
"POT-Creation-Date: 2007-03-26 23:41+0900\n"
|
||||||
"PO-Revision-Date: 2006-05-08 13:39+0900\n"
|
"PO-Revision-Date: 2006-05-08 13:39+0900\n"
|
||||||
"Last-Translator: makoto tsuyuki <mtsuyuki@gmail.com>\n"
|
"Last-Translator: makoto tsuyuki <mtsuyuki@gmail.com>\n"
|
||||||
"Language-Team: Japanese <django-ja@googlegroups.com>\n"
|
"Language-Team: Japanese <django-ja@googlegroups.com>\n"
|
||||||
@ -85,7 +83,7 @@ msgstr "時間を選択"
|
|||||||
|
|
||||||
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:82
|
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:82
|
||||||
msgid "Midnight"
|
msgid "Midnight"
|
||||||
msgstr "夜中"
|
msgstr "0時"
|
||||||
|
|
||||||
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:83
|
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:83
|
||||||
msgid "6 a.m."
|
msgid "6 a.m."
|
||||||
@ -93,7 +91,7 @@ msgstr "午前 6 時"
|
|||||||
|
|
||||||
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:84
|
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:84
|
||||||
msgid "Noon"
|
msgid "Noon"
|
||||||
msgstr "正午"
|
msgstr "12時"
|
||||||
|
|
||||||
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:88
|
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:88
|
||||||
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:183
|
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:183
|
||||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -163,11 +163,11 @@ msgstr "ఫ్లాగ్ తేది "
|
|||||||
|
|
||||||
#: contrib/comments/models.py:268
|
#: contrib/comments/models.py:268
|
||||||
msgid "user flag"
|
msgid "user flag"
|
||||||
msgstr "యూఙర్ ఫ్లాగ్"
|
msgstr "యూజర్ ఫ్లాగ్"
|
||||||
|
|
||||||
#: contrib/comments/models.py:269
|
#: contrib/comments/models.py:269
|
||||||
msgid "user flags"
|
msgid "user flags"
|
||||||
msgstr "యూఙర్ ఫ్లాగులు"
|
msgstr "యూజర్ ఫ్లాగులు"
|
||||||
|
|
||||||
#: contrib/comments/models.py:273
|
#: contrib/comments/models.py:273
|
||||||
#, python-format
|
#, python-format
|
||||||
@ -193,7 +193,7 @@ msgstr "మొదరేటర్ తీసివేసిన %r"
|
|||||||
|
|
||||||
#: contrib/comments/views/karma.py:19
|
#: contrib/comments/views/karma.py:19
|
||||||
msgid "Anonymous users cannot vote"
|
msgid "Anonymous users cannot vote"
|
||||||
msgstr "అపరిచిత యూఙరులు వోటు వేయలేరు"
|
msgstr "అపరిచిత యూజర్లు వోటు వేయలేరు"
|
||||||
|
|
||||||
#: contrib/comments/views/karma.py:23
|
#: contrib/comments/views/karma.py:23
|
||||||
msgid "Invalid comment ID"
|
msgid "Invalid comment ID"
|
||||||
@ -220,12 +220,12 @@ msgid_plural ""
|
|||||||
"\n"
|
"\n"
|
||||||
"%(text)s"
|
"%(text)s"
|
||||||
msgstr[0] ""
|
msgstr[0] ""
|
||||||
"ఈ వ్యాఖ్యానము చేసిన యూఙర్ %(count)లు కన్న తక్కువ సమర్పించాడు "
|
"ఈ వ్యాఖ్యానము చేసిన యూజర్ %(count)లు కన్న తక్కువ సమర్పించాడు "
|
||||||
"వ్యాఖ్యానము:\n"
|
"వ్యాఖ్యానము:\n"
|
||||||
"\n"
|
"\n"
|
||||||
"%(text)s"
|
"%(text)s"
|
||||||
msgstr[1] ""
|
msgstr[1] ""
|
||||||
"ఈ వ్యాఖ్యానము చేసిన యూఙర్ %(count)లు కన్న తక్కువ సమర్పించాడు"
|
"ఈ వ్యాఖ్యానము చేసిన యూజర్ %(count)లు కన్న తక్కువ సమర్పించాడు"
|
||||||
"వ్యాఖ్యానములు:\n"
|
"వ్యాఖ్యానములు:\n"
|
||||||
"\n"
|
"\n"
|
||||||
"%(text)s"
|
"%(text)s"
|
||||||
@ -237,7 +237,7 @@ msgid ""
|
|||||||
"\n"
|
"\n"
|
||||||
"%(text)s"
|
"%(text)s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"ఈ వ్యాఖ్యానము స్కెచి యూఙర్ చేసాడు :\n"
|
"ఈ వ్యాఖ్యానము స్కెచి యూజర్ చేసాడు :\n"
|
||||||
"\n"
|
"\n"
|
||||||
"%(text)s"
|
"%(text)s"
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ msgstr "వ్యాఖ్యానము ఫార్మ్ లో 'ప్ర
|
|||||||
#: contrib/comments/templates/comments/form.html:8
|
#: contrib/comments/templates/comments/form.html:8
|
||||||
#: contrib/admin/templates/admin/login.html:17
|
#: contrib/admin/templates/admin/login.html:17
|
||||||
msgid "Username:"
|
msgid "Username:"
|
||||||
msgstr "యూఙర్ పేరు"
|
msgstr "యూజర్ పేరు"
|
||||||
|
|
||||||
#: contrib/comments/templates/comments/form.html:6
|
#: contrib/comments/templates/comments/form.html:6
|
||||||
#: contrib/admin/templates/admin/object_history.html:3
|
#: contrib/admin/templates/admin/object_history.html:3
|
||||||
@ -353,15 +353,15 @@ msgstr "అన్నీ"
|
|||||||
|
|
||||||
#: contrib/admin/filterspecs.py:109
|
#: contrib/admin/filterspecs.py:109
|
||||||
msgid "Any date"
|
msgid "Any date"
|
||||||
msgstr "ఏ రోఙైన"
|
msgstr "ఏ రోజైన"
|
||||||
|
|
||||||
#: contrib/admin/filterspecs.py:110
|
#: contrib/admin/filterspecs.py:110
|
||||||
msgid "Today"
|
msgid "Today"
|
||||||
msgstr "ఈ రోఙు"
|
msgstr "ఈ రోజు"
|
||||||
|
|
||||||
#: contrib/admin/filterspecs.py:113
|
#: contrib/admin/filterspecs.py:113
|
||||||
msgid "Past 7 days"
|
msgid "Past 7 days"
|
||||||
msgstr "గత 7 రోఙుల గా"
|
msgstr "గత 7 రోజుల గా"
|
||||||
|
|
||||||
#: contrib/admin/filterspecs.py:115
|
#: contrib/admin/filterspecs.py:115
|
||||||
msgid "This month"
|
msgid "This month"
|
||||||
@ -413,13 +413,13 @@ msgstr "లాగ్ ఎంట్రీలు"
|
|||||||
|
|
||||||
#: contrib/admin/templatetags/admin_list.py:230
|
#: contrib/admin/templatetags/admin_list.py:230
|
||||||
msgid "All dates"
|
msgid "All dates"
|
||||||
msgstr "అన్నీ రోఙులు"
|
msgstr "అన్నీ రోజులు"
|
||||||
|
|
||||||
#: contrib/admin/views/decorators.py:10 contrib/auth/forms.py:59
|
#: contrib/admin/views/decorators.py:10 contrib/auth/forms.py:59
|
||||||
msgid ""
|
msgid ""
|
||||||
"Please enter a correct username and password. Note that both fields are case-"
|
"Please enter a correct username and password. Note that both fields are case-"
|
||||||
"sensitive."
|
"sensitive."
|
||||||
msgstr "దయచేసి సరైన యూఙర్ పేరు పాస్ వర్డ్ ఇవ్వండి"
|
msgstr "దయచేసి సరైన యూజర్ పేరు పాస్ వర్డ్ ఇవ్వండి"
|
||||||
|
|
||||||
#: contrib/admin/views/decorators.py:24
|
#: contrib/admin/views/decorators.py:24
|
||||||
#: contrib/admin/templates/admin/login.html:25
|
#: contrib/admin/templates/admin/login.html:25
|
||||||
@ -430,22 +430,22 @@ msgstr "లాగ్ ఇన్"
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Please log in again, because your session has expired. Don't worry: Your "
|
"Please log in again, because your session has expired. Don't worry: Your "
|
||||||
"submission has been saved."
|
"submission has been saved."
|
||||||
msgstr "దయచేసి మళీ లాగ్ ఇన్ అవ్వండి ఎందుకంటే మీ సేస్సన్ ముగిసింది . బాధపడకండి మీ సమర్పన దాచిపెట్టాము"
|
msgstr "దయచేసి మళ్ళీ లాగ్ ఇన్ అవ్వండి ఎందుకంటే మీ సేస్సన్ ముగిసింది . బాధపడకండి మీ సమర్పన దాచిపెట్టాము"
|
||||||
|
|
||||||
#: contrib/admin/views/decorators.py:69
|
#: contrib/admin/views/decorators.py:69
|
||||||
msgid ""
|
msgid ""
|
||||||
"Looks like your browser isn't configured to accept cookies. Please enable "
|
"Looks like your browser isn't configured to accept cookies. Please enable "
|
||||||
"cookies, reload this page, and try again."
|
"cookies, reload this page, and try again."
|
||||||
msgstr "మీ బ్రౌఙర్ పై కుకీస్ అంగీకరించబడేటట్లు చేయలేదు . దయ చేసి కుకీస్ ఎనేబల్ చేసి ,మళ్ళీ ట్రై చేయండి"
|
msgstr "మీ బ్రౌజర్ పై కుకీస్ అంగీకరించేటట్లు చేయలేదు . దయ చేసి కుకీస్ ఎనేబల్ చేసి ,మళ్ళీ ట్రై చేయండి"
|
||||||
|
|
||||||
#: contrib/admin/views/decorators.py:83
|
#: contrib/admin/views/decorators.py:83
|
||||||
msgid "Usernames cannot contain the '@' character."
|
msgid "Usernames cannot contain the '@' character."
|
||||||
msgstr "యూఙర్ పేరు లో '@' అక్షరము ఉందకూడడు"
|
msgstr "యూజర్ పేరు లో '@' అక్షరము ఉందకూడడు"
|
||||||
|
|
||||||
#: contrib/admin/views/decorators.py:85
|
#: contrib/admin/views/decorators.py:85
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Your e-mail address is not your username. Try '%s' instead."
|
msgid "Your e-mail address is not your username. Try '%s' instead."
|
||||||
msgstr "మీ ఈ మెయిల్ అడ్రస్ మీ యూఙర్ పేరు కాదు . '%s' ఇచ్చి చూడండి "
|
msgstr "మీ ఈ మెయిల్ అడ్రస్ మీ యూజర్ పేరు కాదు . '%s' ఇచ్చి చూడండి "
|
||||||
|
|
||||||
#: contrib/admin/views/main.py:223
|
#: contrib/admin/views/main.py:223
|
||||||
msgid "Site administration"
|
msgid "Site administration"
|
||||||
@ -454,7 +454,7 @@ msgstr "సైట్ నిర్వాహన"
|
|||||||
#: contrib/admin/views/main.py:257 contrib/admin/views/auth.py:17
|
#: contrib/admin/views/main.py:257 contrib/admin/views/auth.py:17
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "The %(name)s \"%(obj)s\" was added successfully."
|
msgid "The %(name)s \"%(obj)s\" was added successfully."
|
||||||
msgstr "%(name)s \"%(obj)s\"ఙయప్రదంగా కలపబడ్డడి"
|
msgstr "%(name)s \"%(obj)s\"జయప్రదంగా కలపబడ్డడి"
|
||||||
|
|
||||||
#: contrib/admin/views/main.py:261 contrib/admin/views/main.py:347
|
#: contrib/admin/views/main.py:261 contrib/admin/views/main.py:347
|
||||||
#: contrib/admin/views/auth.py:22
|
#: contrib/admin/views/auth.py:22
|
||||||
@ -464,12 +464,12 @@ msgstr "మీరు మళ్ళీ దీనినీ క్రింద మ
|
|||||||
#: contrib/admin/views/main.py:271 contrib/admin/views/main.py:356
|
#: contrib/admin/views/main.py:271 contrib/admin/views/main.py:356
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "You may add another %s below."
|
msgid "You may add another %s below."
|
||||||
msgstr "మీరు ఇంకొక %s ని క్రింద ఙత చేయొచ్చు"
|
msgstr "మీరు ఇంకొక %s ని క్రింద జత చేయొచ్చు"
|
||||||
|
|
||||||
#: contrib/admin/views/main.py:289
|
#: contrib/admin/views/main.py:289
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Add %s"
|
msgid "Add %s"
|
||||||
msgstr "%s ని ఙత చేయండి "
|
msgstr "%s ని జత చేయండి "
|
||||||
|
|
||||||
#: contrib/admin/views/main.py:335
|
#: contrib/admin/views/main.py:335
|
||||||
#, python-format
|
#, python-format
|
||||||
@ -493,17 +493,17 @@ msgstr "%s తీసివేయబడ్డడి"
|
|||||||
|
|
||||||
#: contrib/admin/views/main.py:342
|
#: contrib/admin/views/main.py:342
|
||||||
msgid "No fields changed."
|
msgid "No fields changed."
|
||||||
msgstr "మార్చబడలేదు"
|
msgstr "ఫీల్డ్స్ ఏమి మార్చబడలేదు"
|
||||||
|
|
||||||
#: contrib/admin/views/main.py:345
|
#: contrib/admin/views/main.py:345
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "The %(name)s \"%(obj)s\" was changed successfully."
|
msgid "The %(name)s \"%(obj)s\" was changed successfully."
|
||||||
msgstr "%(name)s \"%(obj)s\" ఙయప్రదంగా మార్చబడిండి"
|
msgstr "%(name)s \"%(obj)s\" జయప్రదంగా మార్చబడిండి"
|
||||||
|
|
||||||
#: contrib/admin/views/main.py:353
|
#: contrib/admin/views/main.py:353
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "The %(name)s \"%(obj)s\" was added successfully. You may edit it again below."
|
msgid "The %(name)s \"%(obj)s\" was added successfully. You may edit it again below."
|
||||||
msgstr "%(name)s \"%(obj)s\" ఙయప్రదంగా కలపబడ్డడి .మీరు మళ్ళీ దీనినీ క్రింద మార్చవచ్చు"
|
msgstr "%(name)s \"%(obj)s\" జయప్రదంగా కలపబడ్డడి .మీరు మళ్ళీ దీనినీ క్రింద మార్చవచ్చు"
|
||||||
|
|
||||||
#: contrib/admin/views/main.py:391
|
#: contrib/admin/views/main.py:391
|
||||||
#, python-format
|
#, python-format
|
||||||
@ -523,7 +523,7 @@ msgstr "ఒకటి కాని ,అంత కన్నఎక్కువ %(
|
|||||||
#: contrib/admin/views/main.py:511
|
#: contrib/admin/views/main.py:511
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "The %(name)s \"%(obj)s\" was deleted successfully."
|
msgid "The %(name)s \"%(obj)s\" was deleted successfully."
|
||||||
msgstr "%(name)లు \"%(obj)s\"ఙయప్రదంగా తీసివేయబడ్డడి"
|
msgstr "%(name)లు \"%(obj)s\"జయప్రదంగా తీసివేయబడ్డడి"
|
||||||
|
|
||||||
#: contrib/admin/views/main.py:514
|
#: contrib/admin/views/main.py:514
|
||||||
msgid "Are you sure?"
|
msgid "Are you sure?"
|
||||||
@ -601,7 +601,7 @@ msgstr ""
|
|||||||
#: contrib/admin/views/doc.py:229
|
#: contrib/admin/views/doc.py:229
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Fields on %s objects"
|
msgid "Fields on %s objects"
|
||||||
msgstr "వస్తువు"
|
msgstr "%s వస్తువులలో ఫీల్డ్స్ "
|
||||||
|
|
||||||
#: contrib/admin/views/doc.py:291 contrib/admin/views/doc.py:301
|
#: contrib/admin/views/doc.py:291 contrib/admin/views/doc.py:301
|
||||||
#: contrib/admin/views/doc.py:303 contrib/admin/views/doc.py:309
|
#: contrib/admin/views/doc.py:303 contrib/admin/views/doc.py:309
|
||||||
@ -682,7 +682,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: contrib/admin/views/auth.py:28
|
#: contrib/admin/views/auth.py:28
|
||||||
msgid "Add user"
|
msgid "Add user"
|
||||||
msgstr "యూఙర్"
|
msgstr "యూజర్ ని జత చేయండి"
|
||||||
|
|
||||||
#: contrib/admin/templates/admin/object_history.html:3
|
#: contrib/admin/templates/admin/object_history.html:3
|
||||||
#: contrib/admin/templates/admin/change_list.html:5
|
#: contrib/admin/templates/admin/change_list.html:5
|
||||||
@ -742,7 +742,7 @@ msgstr "తేది/వేళ"
|
|||||||
|
|
||||||
#: contrib/admin/templates/admin/object_history.html:19
|
#: contrib/admin/templates/admin/object_history.html:19
|
||||||
msgid "User"
|
msgid "User"
|
||||||
msgstr "యూఙర్"
|
msgstr "యూజర్"
|
||||||
|
|
||||||
#: contrib/admin/templates/admin/object_history.html:20
|
#: contrib/admin/templates/admin/object_history.html:20
|
||||||
msgid "Action"
|
msgid "Action"
|
||||||
@ -760,11 +760,11 @@ msgstr ""
|
|||||||
|
|
||||||
#: contrib/admin/templates/admin/base_site.html:4
|
#: contrib/admin/templates/admin/base_site.html:4
|
||||||
msgid "Django site admin"
|
msgid "Django site admin"
|
||||||
msgstr "డ్ఙాంగొ యొక్క నిర్వాహనదారులు"
|
msgstr "డ్జాంగొ యొక్క నిర్వాహనదారులు"
|
||||||
|
|
||||||
#: contrib/admin/templates/admin/base_site.html:7
|
#: contrib/admin/templates/admin/base_site.html:7
|
||||||
msgid "Django administration"
|
msgid "Django administration"
|
||||||
msgstr "డ్ఙాంగొ నిర్వాహన"
|
msgstr "డ్జాంగొ నిర్వాహన"
|
||||||
|
|
||||||
#: contrib/admin/templates/admin/500.html:4
|
#: contrib/admin/templates/admin/500.html:4
|
||||||
msgid "Server error"
|
msgid "Server error"
|
||||||
@ -782,16 +782,16 @@ msgstr "సర్వర్ తప్పు <em>(500)</em>"
|
|||||||
msgid ""
|
msgid ""
|
||||||
"There's been an error. It's been reported to the site administrators via e-"
|
"There's been an error. It's been reported to the site administrators via e-"
|
||||||
"mail and should be fixed shortly. Thanks for your patience."
|
"mail and should be fixed shortly. Thanks for your patience."
|
||||||
msgstr "తప్పు ఙరిగిండి . దానిని నిర్వాహనాధికారులు కి ఈ మెయిల్ చేయబడ్డడి,మీ ఓపిక కి ధన్యవాదములు"
|
msgstr "తప్పు జరిగిండి . దానిని నిర్వాహనాధికారులు కి ఈ మెయిల్ చేయబడ్డడి,మీ ఓపిక కి ధన్యవాదములు"
|
||||||
|
|
||||||
#: contrib/admin/templates/admin/404.html:4
|
#: contrib/admin/templates/admin/404.html:4
|
||||||
#: contrib/admin/templates/admin/404.html:8
|
#: contrib/admin/templates/admin/404.html:8
|
||||||
msgid "Page not found"
|
msgid "Page not found"
|
||||||
msgstr "పేఙి దొరకలేదు"
|
msgstr "పేజి దొరకలేదు"
|
||||||
|
|
||||||
#: contrib/admin/templates/admin/404.html:10
|
#: contrib/admin/templates/admin/404.html:10
|
||||||
msgid "We're sorry, but the requested page could not be found."
|
msgid "We're sorry, but the requested page could not be found."
|
||||||
msgstr "క్షమించండి మీరు కోరిన పేఙి దొరకలేడు"
|
msgstr "క్షమించండి మీరు కోరిన పేజి దొరకలేడు"
|
||||||
|
|
||||||
#: contrib/admin/templates/admin/index.html:17
|
#: contrib/admin/templates/admin/index.html:17
|
||||||
#, python-format
|
#, python-format
|
||||||
@ -801,12 +801,12 @@ msgstr "మొడల్ లు %(name)లో దొరికే అప్ప్
|
|||||||
#: contrib/admin/templates/admin/index.html:18
|
#: contrib/admin/templates/admin/index.html:18
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "%(name)s"
|
msgid "%(name)s"
|
||||||
msgstr ""
|
msgstr "%(name)లు"
|
||||||
|
|
||||||
#: contrib/admin/templates/admin/index.html:28
|
#: contrib/admin/templates/admin/index.html:28
|
||||||
#: contrib/admin/templates/admin/change_form.html:15
|
#: contrib/admin/templates/admin/change_form.html:15
|
||||||
msgid "Add"
|
msgid "Add"
|
||||||
msgstr "ఙత చేయి"
|
msgstr "జత చేయి"
|
||||||
|
|
||||||
#: contrib/admin/templates/admin/index.html:34
|
#: contrib/admin/templates/admin/index.html:34
|
||||||
msgid "Change"
|
msgid "Change"
|
||||||
@ -831,7 +831,7 @@ msgstr "ఏమి దొరకలేదు"
|
|||||||
#: contrib/admin/templates/admin/change_list.html:11
|
#: contrib/admin/templates/admin/change_list.html:11
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Add %(name)s"
|
msgid "Add %(name)s"
|
||||||
msgstr "%(name)లు ఙత చేయు"
|
msgstr "%(name)లు జత చేయు"
|
||||||
|
|
||||||
#: contrib/admin/templates/admin/login.html:22
|
#: contrib/admin/templates/admin/login.html:22
|
||||||
msgid "Have you <a href=\"/password_reset/\">forgotten your password</a>?"
|
msgid "Have you <a href=\"/password_reset/\">forgotten your password</a>?"
|
||||||
@ -943,7 +943,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: contrib/admin/templates/admin/auth/user/add_form.html:12
|
#: contrib/admin/templates/admin/auth/user/add_form.html:12
|
||||||
msgid "Username"
|
msgid "Username"
|
||||||
msgstr "యూఙర్ పేరు"
|
msgstr "యూజర్ పేరు"
|
||||||
|
|
||||||
#: contrib/admin/templates/admin/auth/user/add_form.html:18
|
#: contrib/admin/templates/admin/auth/user/add_form.html:18
|
||||||
msgid "Password"
|
msgid "Password"
|
||||||
@ -967,7 +967,7 @@ msgstr "పాస్ వర్డ్ మార్పు"
|
|||||||
#: contrib/admin/templates/registration/password_change_done.html:6
|
#: contrib/admin/templates/registration/password_change_done.html:6
|
||||||
#: contrib/admin/templates/registration/password_change_done.html:10
|
#: contrib/admin/templates/registration/password_change_done.html:10
|
||||||
msgid "Password change successful"
|
msgid "Password change successful"
|
||||||
msgstr "పాస్ వర్డ్ మార్పు ఙయప్రదమైండి "
|
msgstr "పాస్ వర్డ్ మార్పు జయప్రదమైండి "
|
||||||
|
|
||||||
#: contrib/admin/templates/registration/password_change_done.html:12
|
#: contrib/admin/templates/registration/password_change_done.html:12
|
||||||
msgid "Your password was changed."
|
msgid "Your password was changed."
|
||||||
@ -1005,7 +1005,7 @@ msgstr "మళ్ళీ లాగ్ ఇన్ అవ్వండి"
|
|||||||
#: contrib/admin/templates/registration/password_reset_done.html:6
|
#: contrib/admin/templates/registration/password_reset_done.html:6
|
||||||
#: contrib/admin/templates/registration/password_reset_done.html:10
|
#: contrib/admin/templates/registration/password_reset_done.html:10
|
||||||
msgid "Password reset successful"
|
msgid "Password reset successful"
|
||||||
msgstr "పాస్ వర్డ్ రీసెట్ ఙయప్రదమైండి"
|
msgstr "పాస్ వర్డ్ రీసెట్ జయప్రదమైండి"
|
||||||
|
|
||||||
#: contrib/admin/templates/registration/password_reset_done.html:12
|
#: contrib/admin/templates/registration/password_reset_done.html:12
|
||||||
msgid ""
|
msgid ""
|
||||||
@ -1051,11 +1051,11 @@ msgstr "మీ కొత్త పాస్ వర్డ్ : %(new_password)s
|
|||||||
|
|
||||||
#: contrib/admin/templates/registration/password_reset_email.html:7
|
#: contrib/admin/templates/registration/password_reset_email.html:7
|
||||||
msgid "Feel free to change this password by going to this page:"
|
msgid "Feel free to change this password by going to this page:"
|
||||||
msgstr "నిస్సందేహము గా ఈ పేఙి క్ కి వెళ్ళి పాస్ వర్డ్ మార్చుకోండి "
|
msgstr "నిస్సందేహము గా ఈ పేజి క్ కి వెళ్ళి పాస్ వర్డ్ మార్చుకోండి "
|
||||||
|
|
||||||
#: contrib/admin/templates/registration/password_reset_email.html:11
|
#: contrib/admin/templates/registration/password_reset_email.html:11
|
||||||
msgid "Your username, in case you've forgotten:"
|
msgid "Your username, in case you've forgotten:"
|
||||||
msgstr "మీ యూఙర్ పేరు, ఒక వేళ మర్చిపోయి ఉంటే "
|
msgstr "మీ యూజర్ పేరు, ఒక వేళ మర్చిపోయి ఉంటే "
|
||||||
|
|
||||||
#: contrib/admin/templates/registration/password_reset_email.html:13
|
#: contrib/admin/templates/registration/password_reset_email.html:13
|
||||||
msgid "Thanks for using our site!"
|
msgid "Thanks for using our site!"
|
||||||
@ -1103,19 +1103,19 @@ msgstr "వస్తువు ఇడి చూడండి"
|
|||||||
msgid ""
|
msgid ""
|
||||||
"Shows the content-type and unique ID for pages that represent a single "
|
"Shows the content-type and unique ID for pages that represent a single "
|
||||||
"object."
|
"object."
|
||||||
msgstr "వస్తువు"
|
msgstr ""
|
||||||
|
|
||||||
#: contrib/admin/templates/admin_doc/bookmarklets.html:25
|
#: contrib/admin/templates/admin_doc/bookmarklets.html:25
|
||||||
msgid "Edit this object (current window)"
|
msgid "Edit this object (current window)"
|
||||||
msgstr "వస్తువు"
|
msgstr "వస్తువు ని మార్చండి (ప్రస్తుత విండొ)"
|
||||||
|
|
||||||
#: contrib/admin/templates/admin_doc/bookmarklets.html:26
|
#: contrib/admin/templates/admin_doc/bookmarklets.html:26
|
||||||
msgid "Jumps to the admin page for pages that represent a single object."
|
msgid "Jumps to the admin page for pages that represent a single object."
|
||||||
msgstr "వస్తువు"
|
msgstr ""
|
||||||
|
|
||||||
#: contrib/admin/templates/admin_doc/bookmarklets.html:28
|
#: contrib/admin/templates/admin_doc/bookmarklets.html:28
|
||||||
msgid "Edit this object (new window)"
|
msgid "Edit this object (new window)"
|
||||||
msgstr "వస్తువు"
|
msgstr "వస్తువు ని మార్చండి(కొత్త విండొ) "
|
||||||
|
|
||||||
#: contrib/admin/templates/admin_doc/bookmarklets.html:29
|
#: contrib/admin/templates/admin_doc/bookmarklets.html:29
|
||||||
msgid "As above, but opens the admin page in a new window."
|
msgid "As above, but opens the admin page in a new window."
|
||||||
@ -1197,7 +1197,7 @@ msgstr "నమొదు చేయటము అవసరం"
|
|||||||
|
|
||||||
#: contrib/flatpages/models.py:14
|
#: contrib/flatpages/models.py:14
|
||||||
msgid "If this is checked, only logged-in users will be able to view the page."
|
msgid "If this is checked, only logged-in users will be able to view the page."
|
||||||
msgstr "ఇది చెక్ చేసి ఉంటే కేవలం లాగ్గడ్ ఇన్ యూఙర్లు పేఙి చూడలేస్తారు"
|
msgstr "ఇది చెక్ చేసి ఉంటే కేవలం లాగ్గడ్ ఇన్ యూజర్లు పేజి చూడలేస్తారు"
|
||||||
|
|
||||||
#: contrib/flatpages/models.py:18
|
#: contrib/flatpages/models.py:18
|
||||||
msgid "flat page"
|
msgid "flat page"
|
||||||
@ -1237,7 +1237,7 @@ msgstr "గుంపులు"
|
|||||||
|
|
||||||
#: contrib/auth/models.py:90
|
#: contrib/auth/models.py:90
|
||||||
msgid "username"
|
msgid "username"
|
||||||
msgstr "యూఙర్ పేరు"
|
msgstr "యూజర్ పేరు"
|
||||||
|
|
||||||
#: contrib/auth/models.py:90
|
#: contrib/auth/models.py:90
|
||||||
msgid ""
|
msgid ""
|
||||||
@ -1309,15 +1309,15 @@ msgstr ""
|
|||||||
|
|
||||||
#: contrib/auth/models.py:102
|
#: contrib/auth/models.py:102
|
||||||
msgid "user permissions"
|
msgid "user permissions"
|
||||||
msgstr "యూఙర్ అనుమతులు"
|
msgstr "యూజర్ అనుమతులు"
|
||||||
|
|
||||||
#: contrib/auth/models.py:105
|
#: contrib/auth/models.py:105
|
||||||
msgid "user"
|
msgid "user"
|
||||||
msgstr "యూఙర్"
|
msgstr "యూజర్"
|
||||||
|
|
||||||
#: contrib/auth/models.py:106
|
#: contrib/auth/models.py:106
|
||||||
msgid "users"
|
msgid "users"
|
||||||
msgstr "యూఙర్లు"
|
msgstr "యూజర్లు"
|
||||||
|
|
||||||
#: contrib/auth/models.py:111
|
#: contrib/auth/models.py:111
|
||||||
msgid "Personal info"
|
msgid "Personal info"
|
||||||
@ -1427,7 +1427,7 @@ msgstr "ఆదివారము"
|
|||||||
|
|
||||||
#: utils/dates.py:14
|
#: utils/dates.py:14
|
||||||
msgid "January"
|
msgid "January"
|
||||||
msgstr "ఙాన్వరి "
|
msgstr "జాన్వరి "
|
||||||
|
|
||||||
#: utils/dates.py:14
|
#: utils/dates.py:14
|
||||||
msgid "February"
|
msgid "February"
|
||||||
@ -1447,11 +1447,11 @@ msgstr "మే"
|
|||||||
|
|
||||||
#: utils/dates.py:14 utils/dates.py:27
|
#: utils/dates.py:14 utils/dates.py:27
|
||||||
msgid "June"
|
msgid "June"
|
||||||
msgstr "ఙూను"
|
msgstr "జూను"
|
||||||
|
|
||||||
#: utils/dates.py:15 utils/dates.py:27
|
#: utils/dates.py:15 utils/dates.py:27
|
||||||
msgid "July"
|
msgid "July"
|
||||||
msgstr "ఙులై"
|
msgstr "జులై"
|
||||||
|
|
||||||
#: utils/dates.py:15
|
#: utils/dates.py:15
|
||||||
msgid "August"
|
msgid "August"
|
||||||
@ -1475,7 +1475,7 @@ msgstr "డిసెంబర్"
|
|||||||
|
|
||||||
#: utils/dates.py:19
|
#: utils/dates.py:19
|
||||||
msgid "jan"
|
msgid "jan"
|
||||||
msgstr "ఙాన్"
|
msgstr "జాన్"
|
||||||
|
|
||||||
#: utils/dates.py:19
|
#: utils/dates.py:19
|
||||||
msgid "feb"
|
msgid "feb"
|
||||||
@ -1495,11 +1495,11 @@ msgstr "మే"
|
|||||||
|
|
||||||
#: utils/dates.py:19
|
#: utils/dates.py:19
|
||||||
msgid "jun"
|
msgid "jun"
|
||||||
msgstr "ఙూన్"
|
msgstr "జూన్"
|
||||||
|
|
||||||
#: utils/dates.py:20
|
#: utils/dates.py:20
|
||||||
msgid "jul"
|
msgid "jul"
|
||||||
msgstr "ఙుల్"
|
msgstr "జుల్"
|
||||||
|
|
||||||
#: utils/dates.py:20
|
#: utils/dates.py:20
|
||||||
msgid "aug"
|
msgid "aug"
|
||||||
@ -1523,7 +1523,7 @@ msgstr "డిస్"
|
|||||||
|
|
||||||
#: utils/dates.py:27
|
#: utils/dates.py:27
|
||||||
msgid "Jan."
|
msgid "Jan."
|
||||||
msgstr "ఙాన్"
|
msgstr "జాన్"
|
||||||
|
|
||||||
#: utils/dates.py:27
|
#: utils/dates.py:27
|
||||||
msgid "Feb."
|
msgid "Feb."
|
||||||
@ -1570,8 +1570,8 @@ msgstr[1] "వారాలు"
|
|||||||
#: utils/timesince.py:15
|
#: utils/timesince.py:15
|
||||||
msgid "day"
|
msgid "day"
|
||||||
msgid_plural "days"
|
msgid_plural "days"
|
||||||
msgstr[0] "రోఙు"
|
msgstr[0] "రోజు"
|
||||||
msgstr[1] "రోఙులు"
|
msgstr[1] "రోజులు"
|
||||||
|
|
||||||
#: utils/timesince.py:16
|
#: utils/timesince.py:16
|
||||||
msgid "hour"
|
msgid "hour"
|
||||||
@ -1615,7 +1615,7 @@ msgstr "బెంగాలి"
|
|||||||
|
|
||||||
#: conf/global_settings.py:41
|
#: conf/global_settings.py:41
|
||||||
msgid "Czech"
|
msgid "Czech"
|
||||||
msgstr "క్ఙెఖ్"
|
msgstr "క్జెఖ్"
|
||||||
|
|
||||||
#: conf/global_settings.py:42
|
#: conf/global_settings.py:42
|
||||||
msgid "Welsh"
|
msgid "Welsh"
|
||||||
@ -1627,7 +1627,7 @@ msgstr "డానిశ్"
|
|||||||
|
|
||||||
#: conf/global_settings.py:44
|
#: conf/global_settings.py:44
|
||||||
msgid "German"
|
msgid "German"
|
||||||
msgstr "ఙెర్మన్"
|
msgstr "జెర్మన్"
|
||||||
|
|
||||||
#: conf/global_settings.py:45
|
#: conf/global_settings.py:45
|
||||||
msgid "Greek"
|
msgid "Greek"
|
||||||
@ -1643,7 +1643,7 @@ msgstr "స్పానిష్"
|
|||||||
|
|
||||||
#: conf/global_settings.py:48
|
#: conf/global_settings.py:48
|
||||||
msgid "Argentinean Spanish"
|
msgid "Argentinean Spanish"
|
||||||
msgstr "అర్ఙంటీనా స్పానిష్"
|
msgstr "అర్జంటీనా స్పానిష్"
|
||||||
|
|
||||||
#: conf/global_settings.py:49
|
#: conf/global_settings.py:49
|
||||||
msgid "Finnish"
|
msgid "Finnish"
|
||||||
@ -1675,7 +1675,7 @@ msgstr "ఇటాలియవ్"
|
|||||||
|
|
||||||
#: conf/global_settings.py:56
|
#: conf/global_settings.py:56
|
||||||
msgid "Japanese"
|
msgid "Japanese"
|
||||||
msgstr "ఙపనీస్"
|
msgstr "జపనీస్"
|
||||||
|
|
||||||
#: conf/global_settings.py:57
|
#: conf/global_settings.py:57
|
||||||
msgid "Dutch"
|
msgid "Dutch"
|
||||||
@ -1683,11 +1683,11 @@ msgstr "డట్చ్"
|
|||||||
|
|
||||||
#: conf/global_settings.py:58
|
#: conf/global_settings.py:58
|
||||||
msgid "Norwegian"
|
msgid "Norwegian"
|
||||||
msgstr "నార్వీఙియన్"
|
msgstr "నార్వీజియన్"
|
||||||
|
|
||||||
#: conf/global_settings.py:59
|
#: conf/global_settings.py:59
|
||||||
msgid "Brazilian"
|
msgid "Brazilian"
|
||||||
msgstr "బ్రఙీలియన్"
|
msgstr "బ్రజీలియన్"
|
||||||
|
|
||||||
#: conf/global_settings.py:60
|
#: conf/global_settings.py:60
|
||||||
msgid "Romanian"
|
msgid "Romanian"
|
||||||
@ -1865,7 +1865,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: core/validators.py:242
|
#: core/validators.py:242
|
||||||
msgid "Enter a valid U.S. state abbreviation."
|
msgid "Enter a valid U.S. state abbreviation."
|
||||||
msgstr "దయచేసి సరైన అగ్ర రాఙ్య సంక్షేపము చేసిన రాష్ట్రము పేరు ఇవ్వండి"
|
msgstr "దయచేసి సరైన అగ్ర రాజ్య సంక్షేపము చేసిన రాష్ట్రము పేరు ఇవ్వండి"
|
||||||
|
|
||||||
#: core/validators.py:256
|
#: core/validators.py:256
|
||||||
#, python-format
|
#, python-format
|
||||||
@ -2004,12 +2004,12 @@ msgstr ""
|
|||||||
#: views/generic/create_update.py:43
|
#: views/generic/create_update.py:43
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "The %(verbose_name)s was created successfully."
|
msgid "The %(verbose_name)s was created successfully."
|
||||||
msgstr "%(verbose_name)లు ఙయప్రదంగా తయారయింది"
|
msgstr "%(verbose_name)లు జయప్రదంగా తయారయింది"
|
||||||
|
|
||||||
#: views/generic/create_update.py:117
|
#: views/generic/create_update.py:117
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "The %(verbose_name)s was updated successfully."
|
msgid "The %(verbose_name)s was updated successfully."
|
||||||
msgstr "%(verbose_name)లు ఙయప్రదంగా @@"
|
msgstr "%(verbose_name)లు జయప్రదంగా @@"
|
||||||
|
|
||||||
#: views/generic/create_update.py:184
|
#: views/generic/create_update.py:184
|
||||||
#, python-format
|
#, python-format
|
||||||
|
@ -1,19 +1,25 @@
|
|||||||
from django.core.urlresolvers import RegexURLPattern, RegexURLResolver
|
from django.core.urlresolvers import RegexURLPattern, RegexURLResolver
|
||||||
|
|
||||||
__all__ = ['handler404', 'handler500', 'include', 'patterns']
|
__all__ = ['handler404', 'handler500', 'include', 'patterns', 'url']
|
||||||
|
|
||||||
handler404 = 'django.views.defaults.page_not_found'
|
handler404 = 'django.views.defaults.page_not_found'
|
||||||
handler500 = 'django.views.defaults.server_error'
|
handler500 = 'django.views.defaults.server_error'
|
||||||
|
|
||||||
include = lambda urlconf_module: [urlconf_module]
|
include = lambda urlconf_module: [urlconf_module]
|
||||||
|
|
||||||
def patterns(prefix, *tuples):
|
def patterns(prefix, *args):
|
||||||
pattern_list = []
|
pattern_list = []
|
||||||
for t in tuples:
|
for t in args:
|
||||||
regex, view_or_include = t[:2]
|
if isinstance(t, (list, tuple)):
|
||||||
default_kwargs = t[2:]
|
pattern_list.append(url(prefix=prefix, *t))
|
||||||
if type(view_or_include) == list:
|
|
||||||
pattern_list.append(RegexURLResolver(regex, view_or_include[0], *default_kwargs))
|
|
||||||
else:
|
else:
|
||||||
pattern_list.append(RegexURLPattern(regex, prefix and (prefix + '.' + view_or_include) or view_or_include, *default_kwargs))
|
pattern_list.append(t)
|
||||||
return pattern_list
|
return pattern_list
|
||||||
|
|
||||||
|
def url(regex, view, kwargs=None, name=None, prefix=''):
|
||||||
|
if type(view) == list:
|
||||||
|
# For include(...) processing.
|
||||||
|
return RegexURLResolver(regex, view[0], kwargs)
|
||||||
|
else:
|
||||||
|
return RegexURLPattern(regex, prefix and (prefix + '.' + view) or view, kwargs, name)
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ class FreeComment(models.Model):
|
|||||||
class KarmaScoreManager(models.Manager):
|
class KarmaScoreManager(models.Manager):
|
||||||
def vote(self, user_id, comment_id, score):
|
def vote(self, user_id, comment_id, score):
|
||||||
try:
|
try:
|
||||||
karma = self.objects.get(comment__pk=comment_id, user__pk=user_id)
|
karma = self.get(comment__pk=comment_id, user__pk=user_id)
|
||||||
except self.model.DoesNotExist:
|
except self.model.DoesNotExist:
|
||||||
karma = self.model(None, user_id=user_id, comment_id=comment_id, score=score, scored_date=datetime.datetime.now())
|
karma = self.model(None, user_id=user_id, comment_id=comment_id, score=score, scored_date=datetime.datetime.now())
|
||||||
karma.save()
|
karma.save()
|
||||||
|
@ -4,7 +4,7 @@ from django.contrib.sites.models import Site
|
|||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
class FlatPage(models.Model):
|
class FlatPage(models.Model):
|
||||||
url = models.CharField(_('URL'), maxlength=100, validator_list=[validators.isAlphaNumericURL],
|
url = models.CharField(_('URL'), maxlength=100, validator_list=[validators.isAlphaNumericURL], db_index=True,
|
||||||
help_text=_("Example: '/about/contact/'. Make sure to have leading and trailing slashes."))
|
help_text=_("Example: '/about/contact/'. Make sure to have leading and trailing slashes."))
|
||||||
title = models.CharField(_('title'), maxlength=200)
|
title = models.CharField(_('title'), maxlength=200)
|
||||||
content = models.TextField(_('content'))
|
content = models.TextField(_('content'))
|
||||||
|
0
django/contrib/localflavor/br/__init__.py
Normal file
0
django/contrib/localflavor/br/__init__.py
Normal file
39
django/contrib/localflavor/br/br_states.py
Normal file
39
django/contrib/localflavor/br/br_states.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
A brazilian mapping of state misspellings/abbreviations to normalized
|
||||||
|
abbreviations, and an alphabetical list of states for use as `choices
|
||||||
|
in a formfield.
|
||||||
|
|
||||||
|
This exists in this standalone file so that it's only imported into
|
||||||
|
memory when explicitly needed.
|
||||||
|
"""
|
||||||
|
|
||||||
|
STATE_CHOICES = (
|
||||||
|
('AC', 'Acre'),
|
||||||
|
('AL', 'Alagoas'),
|
||||||
|
('AP', u'Amapá'),
|
||||||
|
('AM', 'Amazonas'),
|
||||||
|
('BA', 'Bahia'),
|
||||||
|
('CE', u'Ceará'),
|
||||||
|
('DF', 'Distrito Federal'),
|
||||||
|
('ES', u'Espírito Santo'),
|
||||||
|
('GO', u'Goiás'),
|
||||||
|
('MA', u'Maranhão'),
|
||||||
|
('MT', 'Mato Grosso'),
|
||||||
|
('MS', 'Mato Grosso do Sul'),
|
||||||
|
('MG', 'Minas Gerais'),
|
||||||
|
('PA', u'Pará'),
|
||||||
|
('PB', u'Paraíba'),
|
||||||
|
('PR', u'Paraná'),
|
||||||
|
('PE', 'Pernambuco'),
|
||||||
|
('PI', u'Piauí'),
|
||||||
|
('RJ', 'Rio de Janeiro'),
|
||||||
|
('RN', 'Rio Grande do Norte'),
|
||||||
|
('RS', 'Rio Grande do Sul'),
|
||||||
|
('RO', u'Rondônia'),
|
||||||
|
('RR', 'Roraima'),
|
||||||
|
('SC', 'Santa Catarina'),
|
||||||
|
('SP', u'São Paulo'),
|
||||||
|
('SE', 'Sergipe'),
|
||||||
|
('TO', 'Tocantins'),
|
||||||
|
)
|
39
django/contrib/localflavor/br/forms.py
Normal file
39
django/contrib/localflavor/br/forms.py
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
BR-specific Form helpers
|
||||||
|
"""
|
||||||
|
|
||||||
|
from django.newforms import ValidationError
|
||||||
|
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
|
||||||
|
from django.utils.encoding import smart_unicode
|
||||||
|
from django.utils.translation import gettext
|
||||||
|
import re
|
||||||
|
|
||||||
|
phone_digits_re = re.compile(r'^(\d{2})[-\.]?(\d{4})[-\.]?(\d{4})$')
|
||||||
|
|
||||||
|
class BRZipCodeField(RegexField):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(BRZipCodeField, self).__init__(r'^\d{5}-\d{3}$',
|
||||||
|
max_length=None, min_length=None,
|
||||||
|
error_message=gettext(u'Enter a zip code in the format XXXXX-XXX.'),
|
||||||
|
*args, **kwargs)
|
||||||
|
|
||||||
|
class BRPhoneNumberField(Field):
|
||||||
|
def clean(self, value):
|
||||||
|
super(BRPhoneNumberField, self).clean(value)
|
||||||
|
if value in EMPTY_VALUES:
|
||||||
|
return u''
|
||||||
|
value = re.sub('(\(|\)|\s+)', '', smart_unicode(value))
|
||||||
|
m = phone_digits_re.search(value)
|
||||||
|
if m:
|
||||||
|
return u'%s-%s-%s' % (m.group(1), m.group(2), m.group(3))
|
||||||
|
raise ValidationError(gettext(u'Phone numbers must be in XX-XXXX-XXXX format.'))
|
||||||
|
|
||||||
|
class BRStateSelect(Select):
|
||||||
|
"""
|
||||||
|
A Select widget that uses a list of brazilian states/territories
|
||||||
|
as its choices.
|
||||||
|
"""
|
||||||
|
def __init__(self, attrs=None):
|
||||||
|
from br_states import STATE_CHOICES # relative import
|
||||||
|
super(BRStateSelect, self).__init__(attrs, choices=STATE_CHOICES)
|
0
django/contrib/localflavor/de/__init__.py
Normal file
0
django/contrib/localflavor/de/__init__.py
Normal file
21
django/contrib/localflavor/de/de_states.py
Normal file
21
django/contrib/localflavor/de/de_states.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# -*- coding: utf-8 -*
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
STATE_CHOICES = (
|
||||||
|
('BW', _('Baden-Wuerttemberg')),
|
||||||
|
('BY', _('Bavaria')),
|
||||||
|
('BE', _('Berlin')),
|
||||||
|
('BB', _('Brandenburg')),
|
||||||
|
('HB', _('Bremen')),
|
||||||
|
('HH', _('Hamburg')),
|
||||||
|
('HE', _('Hessen')),
|
||||||
|
('MV', _('Mecklenburg-Western Pomerania')),
|
||||||
|
('NI', _('Lower Saxony')),
|
||||||
|
('NW', _('North Rhine-Westphalia')),
|
||||||
|
('RP', _('Rhineland-Palatinate')),
|
||||||
|
('SL', _('Saarland')),
|
||||||
|
('SN', _('Saxony')),
|
||||||
|
('ST', _('Saxony-Anhalt')),
|
||||||
|
('SH', _('Schleswig-Holstein')),
|
||||||
|
('TH', _('Thuringia')),
|
||||||
|
)
|
79
django/contrib/localflavor/de/forms.py
Normal file
79
django/contrib/localflavor/de/forms.py
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
"""
|
||||||
|
DE-specific Form helpers
|
||||||
|
"""
|
||||||
|
|
||||||
|
from django.newforms import ValidationError
|
||||||
|
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
|
||||||
|
from django.utils.translation import gettext
|
||||||
|
import re
|
||||||
|
|
||||||
|
id_re = re.compile(r"^(?P<residence>\d{10})(?P<origin>\w{1,3})[-\ ]?(?P<birthday>\d{7})[-\ ]?(?P<validity>\d{7})[-\ ]?(?P<checksum>\d{1})$")
|
||||||
|
|
||||||
|
class DEZipCodeField(RegexField):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(DEZipCodeField, self).__init__(r'^\d{5}$',
|
||||||
|
max_length=None, min_length=None,
|
||||||
|
error_message=gettext(u'Enter a zip code in the format XXXXX.'),
|
||||||
|
*args, **kwargs)
|
||||||
|
|
||||||
|
class DEStateSelect(Select):
|
||||||
|
"""
|
||||||
|
A Select widget that uses a list of DE states as its choices.
|
||||||
|
"""
|
||||||
|
def __init__(self, attrs=None):
|
||||||
|
from de_states import STATE_CHOICES # relative import
|
||||||
|
super(DEStateSelect, self).__init__(attrs, choices=STATE_CHOICES)
|
||||||
|
|
||||||
|
class DEIdentityCardNumberField(Field):
|
||||||
|
"""
|
||||||
|
A German identity card number.
|
||||||
|
|
||||||
|
Checks the following rules to determine whether the number is valid:
|
||||||
|
|
||||||
|
* Conforms to the XXXXXXXXXXX-XXXXXXX-XXXXXXX-X format.
|
||||||
|
* No group consists entirely of zeroes.
|
||||||
|
* Included checksums match calculated checksums
|
||||||
|
|
||||||
|
Algorithm is documented at http://de.wikipedia.org/wiki/Personalausweis
|
||||||
|
"""
|
||||||
|
def has_valid_checksum(self, number):
|
||||||
|
given_number, given_checksum = number[:-1], number[-1]
|
||||||
|
calculated_checksum = 0
|
||||||
|
fragment = ""
|
||||||
|
parameter = 7
|
||||||
|
|
||||||
|
for i in range(len(given_number)):
|
||||||
|
fragment = str(int(given_number[i]) * parameter)
|
||||||
|
if fragment.isalnum():
|
||||||
|
calculated_checksum += int(fragment[-1])
|
||||||
|
if parameter == 1:
|
||||||
|
parameter = 7
|
||||||
|
elif parameter == 3:
|
||||||
|
parameter = 1
|
||||||
|
elif parameter ==7:
|
||||||
|
parameter = 3
|
||||||
|
|
||||||
|
return str(calculated_checksum)[-1] == given_checksum
|
||||||
|
|
||||||
|
def clean(self, value):
|
||||||
|
super(DEIdentityCardNumberField, self).clean(value)
|
||||||
|
error_msg = gettext(u'Enter a valid German identity card number in XXXXXXXXXXX-XXXXXXX-XXXXXXX-X format.')
|
||||||
|
if value in EMPTY_VALUES:
|
||||||
|
return u''
|
||||||
|
match = re.match(id_re, value)
|
||||||
|
if not match:
|
||||||
|
raise ValidationError(error_msg)
|
||||||
|
|
||||||
|
gd = match.groupdict()
|
||||||
|
residence, origin = gd['residence'], gd['origin']
|
||||||
|
birthday, validity, checksum = gd['birthday'], gd['validity'], gd['checksum']
|
||||||
|
|
||||||
|
if residence == '0000000000' or birthday == '0000000' or validity == '0000000':
|
||||||
|
raise ValidationError(error_msg)
|
||||||
|
|
||||||
|
all_digits = "%s%s%s%s" % (residence, birthday, validity, checksum)
|
||||||
|
if not self.has_valid_checksum(residence) or not self.has_valid_checksum(birthday) or \
|
||||||
|
not self.has_valid_checksum(validity) or not self.has_valid_checksum(all_digits):
|
||||||
|
raise ValidationError(error_msg)
|
||||||
|
|
||||||
|
return u'%s%s-%s-%s-%s' % (residence, origin, birthday, validity, checksum)
|
0
django/contrib/localflavor/fi/__init__.py
Normal file
0
django/contrib/localflavor/fi/__init__.py
Normal file
427
django/contrib/localflavor/fi/fi_municipalities.py
Normal file
427
django/contrib/localflavor/fi/fi_municipalities.py
Normal file
@ -0,0 +1,427 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
An alphabetical list of Finnish municipalities for use as `choices` in a
|
||||||
|
formfield.
|
||||||
|
|
||||||
|
This exists in this standalone file so that it's only imported into memory
|
||||||
|
when explicitly needed.
|
||||||
|
"""
|
||||||
|
|
||||||
|
MUNICIPALITY_CHOICES = (
|
||||||
|
('akaa', u"Akaa"),
|
||||||
|
('alaharma', u"Alahärmä"),
|
||||||
|
('alajarvi', u"Alajärvi"),
|
||||||
|
('alastaro', u"Alastaro"),
|
||||||
|
('alavieska', u"Alavieska"),
|
||||||
|
('alavus', u"Alavus"),
|
||||||
|
('anjalankoski', u"Anjalankoski"),
|
||||||
|
('artjarvi', u"Artjärvi"),
|
||||||
|
('asikkala', u"Asikkala"),
|
||||||
|
('askainen', u"Askainen"),
|
||||||
|
('askola', u"Askola"),
|
||||||
|
('aura', u"Aura"),
|
||||||
|
('brando', u"Brändö"),
|
||||||
|
('dragsfjard', u"Dragsfjärd"),
|
||||||
|
('eckero', u"Eckerö"),
|
||||||
|
('elimaki', u"Elimäki"),
|
||||||
|
('eno', u"Eno"),
|
||||||
|
('enonkoski', u"Enonkoski"),
|
||||||
|
('enontekio', u"Enontekiö"),
|
||||||
|
('espoo', u"Espoo"),
|
||||||
|
('eura', u"Eura"),
|
||||||
|
('eurajoki', u"Eurajoki"),
|
||||||
|
('evijarvi', u"Evijärvi"),
|
||||||
|
('finstrom', u"Finström"),
|
||||||
|
('forssa', u"Forssa"),
|
||||||
|
('foglo', u"Föglö"),
|
||||||
|
('geta', u"Geta"),
|
||||||
|
('haapajarvi', u"Haapajärvi"),
|
||||||
|
('haapavesi', u"Haapavesi"),
|
||||||
|
('hailuoto', u"Hailuoto"),
|
||||||
|
('halikko', u"Halikko"),
|
||||||
|
('halsua', u"Halsua"),
|
||||||
|
('hamina', u"Hamina"),
|
||||||
|
('hammarland', u"Hammarland"),
|
||||||
|
('hankasalmi', u"Hankasalmi"),
|
||||||
|
('hanko', u"Hanko"),
|
||||||
|
('harjavalta', u"Harjavalta"),
|
||||||
|
('hartola', u"Hartola"),
|
||||||
|
('hattula', u"Hattula"),
|
||||||
|
('hauho', u"Hauho"),
|
||||||
|
('haukipudas', u"Haukipudas"),
|
||||||
|
('hausjarvi', u"Hausjärvi"),
|
||||||
|
('heinola', u"Heinola"),
|
||||||
|
('heinavesi', u"Heinävesi"),
|
||||||
|
('helsinki', u"Helsinki"),
|
||||||
|
('himanka', u"Himanka"),
|
||||||
|
('hirvensalmi', u"Hirvensalmi"),
|
||||||
|
('hollola', u"Hollola"),
|
||||||
|
('honkajoki', u"Honkajoki"),
|
||||||
|
('houtskari', u"Houtskari"),
|
||||||
|
('huittinen', u"Huittinen"),
|
||||||
|
('humppila', u"Humppila"),
|
||||||
|
('hyrynsalmi', u"Hyrynsalmi"),
|
||||||
|
('hyvinkaa', u"Hyvinkää"),
|
||||||
|
('hameenkoski', u"Hämeenkoski"),
|
||||||
|
('hameenkyro', u"Hämeenkyrö"),
|
||||||
|
('hameenlinna', u"Hämeenlinna"),
|
||||||
|
('ii', u"Ii"),
|
||||||
|
('iisalmi', u"Iisalmi"),
|
||||||
|
('iitti', u"Iitti"),
|
||||||
|
('ikaalinen', u"Ikaalinen"),
|
||||||
|
('ilmajoki', u"Ilmajoki"),
|
||||||
|
('ilomantsi', u"Ilomantsi"),
|
||||||
|
('imatra', u"Imatra"),
|
||||||
|
('inari', u"Inari"),
|
||||||
|
('inio', u"Iniö"),
|
||||||
|
('inkoo', u"Inkoo"),
|
||||||
|
('isojoki', u"Isojoki"),
|
||||||
|
('isokyro', u"Isokyrö"),
|
||||||
|
('jaala', u"Jaala"),
|
||||||
|
('jalasjarvi', u"Jalasjärvi"),
|
||||||
|
('janakkala', u"Janakkala"),
|
||||||
|
('joensuu', u"Joensuu"),
|
||||||
|
('jokioinen', u"Jokioinen"),
|
||||||
|
('jomala', u"Jomala"),
|
||||||
|
('joroinen', u"Joroinen"),
|
||||||
|
('joutsa', u"Joutsa"),
|
||||||
|
('joutseno', u"Joutseno"),
|
||||||
|
('juankoski', u"Juankoski"),
|
||||||
|
('jurva', u"Jurva"),
|
||||||
|
('juuka', u"Juuka"),
|
||||||
|
('juupajoki', u"Juupajoki"),
|
||||||
|
('juva', u"Juva"),
|
||||||
|
('jyvaskyla', u"Jyväskylä"),
|
||||||
|
('jyvaskylan_mlk', u"Jyväskylän maalaiskunta"),
|
||||||
|
('jamijarvi', u"Jämijärvi"),
|
||||||
|
('jamsa', u"Jämsä"),
|
||||||
|
('jamsankoski', u"Jämsänkoski"),
|
||||||
|
('jarvenpaa', u"Järvenpää"),
|
||||||
|
('kaarina', u"Kaarina"),
|
||||||
|
('kaavi', u"Kaavi"),
|
||||||
|
('kajaani', u"Kajaani"),
|
||||||
|
('kalajoki', u"Kalajoki"),
|
||||||
|
('kalvola', u"Kalvola"),
|
||||||
|
('kangasala', u"Kangasala"),
|
||||||
|
('kangasniemi', u"Kangasniemi"),
|
||||||
|
('kankaanpaa', u"Kankaanpää"),
|
||||||
|
('kannonkoski', u"Kannonkoski"),
|
||||||
|
('kannus', u"Kannus"),
|
||||||
|
('karijoki', u"Karijoki"),
|
||||||
|
('karjaa', u"Karjaa"),
|
||||||
|
('karjalohja', u"Karjalohja"),
|
||||||
|
('karkkila', u"Karkkila"),
|
||||||
|
('karstula', u"Karstula"),
|
||||||
|
('karttula', u"Karttula"),
|
||||||
|
('karvia', u"Karvia"),
|
||||||
|
('kaskinen', u"Kaskinen"),
|
||||||
|
('kauhajoki', u"Kauhajoki"),
|
||||||
|
('kauhava', u"Kauhava"),
|
||||||
|
('kauniainen', u"Kauniainen"),
|
||||||
|
('kaustinen', u"Kaustinen"),
|
||||||
|
('keitele', u"Keitele"),
|
||||||
|
('kemi', u"Kemi"),
|
||||||
|
('kemijarvi', u"Kemijärvi"),
|
||||||
|
('keminmaa', u"Keminmaa"),
|
||||||
|
('kemio', u"Kemiö"),
|
||||||
|
('kempele', u"Kempele"),
|
||||||
|
('kerava', u"Kerava"),
|
||||||
|
('kerimaki', u"Kerimäki"),
|
||||||
|
('kestila', u"Kestilä"),
|
||||||
|
('kesalahti', u"Kesälahti"),
|
||||||
|
('keuruu', u"Keuruu"),
|
||||||
|
('kihnio', u"Kihniö"),
|
||||||
|
('kiikala', u"Kiikala"),
|
||||||
|
('kiikoinen', u"Kiikoinen"),
|
||||||
|
('kiiminki', u"Kiiminki"),
|
||||||
|
('kinnula', u"Kinnula"),
|
||||||
|
('kirkkonummi', u"Kirkkonummi"),
|
||||||
|
('kisko', u"Kisko"),
|
||||||
|
('kitee', u"Kitee"),
|
||||||
|
('kittila', u"Kittilä"),
|
||||||
|
('kiukainen', u"Kiukainen"),
|
||||||
|
('kiuruvesi', u"Kiuruvesi"),
|
||||||
|
('kivijarvi', u"Kivijärvi"),
|
||||||
|
('kokemaki', u"Kokemäki"),
|
||||||
|
('kokkola', u"Kokkola"),
|
||||||
|
('kolari', u"Kolari"),
|
||||||
|
('konnevesi', u"Konnevesi"),
|
||||||
|
('kontiolahti', u"Kontiolahti"),
|
||||||
|
('korpilahti', u"Korpilahti"),
|
||||||
|
('korppoo', u"Korppoo"),
|
||||||
|
('korsnas', u"Korsnäs"),
|
||||||
|
('kortesjarvi', u"Kortesjärvi"),
|
||||||
|
('koskitl', u"KoskiTl"),
|
||||||
|
('kotka', u"Kotka"),
|
||||||
|
('kouvola', u"Kouvola"),
|
||||||
|
('kristiinankaupunki', u"Kristiinankaupunki"),
|
||||||
|
('kruunupyy', u"Kruunupyy"),
|
||||||
|
('kuhmalahti', u"Kuhmalahti"),
|
||||||
|
('kuhmo', u"Kuhmo"),
|
||||||
|
('kuhmoinen', u"Kuhmoinen"),
|
||||||
|
('kumlinge', u"Kumlinge"),
|
||||||
|
('kuopio', u"Kuopio"),
|
||||||
|
('kuortane', u"Kuortane"),
|
||||||
|
('kurikka', u"Kurikka"),
|
||||||
|
('kuru', u"Kuru"),
|
||||||
|
('kustavi', u"Kustavi"),
|
||||||
|
('kuusamo', u"Kuusamo"),
|
||||||
|
('kuusankoski', u"Kuusankoski"),
|
||||||
|
('kuusjoki', u"Kuusjoki"),
|
||||||
|
('kylmakoski', u"Kylmäkoski"),
|
||||||
|
('kyyjarvi', u"Kyyjärvi"),
|
||||||
|
('kalvia', u"Kälviä"),
|
||||||
|
('karkola', u"Kärkölä"),
|
||||||
|
('karsamaki', u"Kärsämäki"),
|
||||||
|
('kokar', u"Kökar"),
|
||||||
|
('koylio', u"Köyliö"),
|
||||||
|
('lahti', u"Lahti"),
|
||||||
|
('laihia', u"Laihia"),
|
||||||
|
('laitila', u"Laitila"),
|
||||||
|
('lammi', u"Lammi"),
|
||||||
|
('lapinjarvi', u"Lapinjärvi"),
|
||||||
|
('lapinlahti', u"Lapinlahti"),
|
||||||
|
('lappajarvi', u"Lappajärvi"),
|
||||||
|
('lappeenranta', u"Lappeenranta"),
|
||||||
|
('lappi', u"Lappi"),
|
||||||
|
('lapua', u"Lapua"),
|
||||||
|
('laukaa', u"Laukaa"),
|
||||||
|
('lavia', u"Lavia"),
|
||||||
|
('lehtimaki', u"Lehtimäki"),
|
||||||
|
('leivonmaki', u"Leivonmäki"),
|
||||||
|
('lemi', u"Lemi"),
|
||||||
|
('lemland', u"Lemland"),
|
||||||
|
('lempaala', u"Lempäälä"),
|
||||||
|
('lemu', u"Lemu"),
|
||||||
|
('leppavirta', u"Leppävirta"),
|
||||||
|
('lestijarvi', u"Lestijärvi"),
|
||||||
|
('lieksa', u"Lieksa"),
|
||||||
|
('lieto', u"Lieto"),
|
||||||
|
('liljendal', u"Liljendal"),
|
||||||
|
('liminka', u"Liminka"),
|
||||||
|
('liperi', u"Liperi"),
|
||||||
|
('lohja', u"Lohja"),
|
||||||
|
('lohtaja', u"Lohtaja"),
|
||||||
|
('loimaa', u"Loimaa"),
|
||||||
|
('loppi', u"Loppi"),
|
||||||
|
('loviisa', u"Loviisa"),
|
||||||
|
('luhanka', u"Luhanka"),
|
||||||
|
('lumijoki', u"Lumijoki"),
|
||||||
|
('lumparland', u"Lumparland"),
|
||||||
|
('luoto', u"Luoto"),
|
||||||
|
('luumaki', u"Luumäki"),
|
||||||
|
('luvia', u"Luvia"),
|
||||||
|
('maalahti', u"Maalahti"),
|
||||||
|
('maaninka', u"Maaninka"),
|
||||||
|
('maarianhamina', u"Maarianhamina"),
|
||||||
|
('marttila', u"Marttila"),
|
||||||
|
('masku', u"Masku"),
|
||||||
|
('mellila', u"Mellilä"),
|
||||||
|
('merijarvi', u"Merijärvi"),
|
||||||
|
('merikarvia', u"Merikarvia"),
|
||||||
|
('merimasku', u"Merimasku"),
|
||||||
|
('miehikkala', u"Miehikkälä"),
|
||||||
|
('mikkeli', u"Mikkeli"),
|
||||||
|
('mouhijarvi', u"Mouhijärvi"),
|
||||||
|
('muhos', u"Muhos"),
|
||||||
|
('multia', u"Multia"),
|
||||||
|
('muonio', u"Muonio"),
|
||||||
|
('mustasaari', u"Mustasaari"),
|
||||||
|
('muurame', u"Muurame"),
|
||||||
|
('muurla', u"Muurla"),
|
||||||
|
('mynamaki', u"Mynämäki"),
|
||||||
|
('myrskyla', u"Myrskylä"),
|
||||||
|
('mantsala', u"Mäntsälä"),
|
||||||
|
('mantta', u"Mänttä"),
|
||||||
|
('mantyharju', u"Mäntyharju"),
|
||||||
|
('naantali', u"Naantali"),
|
||||||
|
('nakkila', u"Nakkila"),
|
||||||
|
('nastola', u"Nastola"),
|
||||||
|
('nauvo', u"Nauvo"),
|
||||||
|
('nilsia', u"Nilsiä"),
|
||||||
|
('nivala', u"Nivala"),
|
||||||
|
('nokia', u"Nokia"),
|
||||||
|
('noormarkku', u"Noormarkku"),
|
||||||
|
('nousiainen', u"Nousiainen"),
|
||||||
|
('nummi-pusula', u"Nummi-Pusula"),
|
||||||
|
('nurmes', u"Nurmes"),
|
||||||
|
('nurmijarvi', u"Nurmijärvi"),
|
||||||
|
('nurmo', u"Nurmo"),
|
||||||
|
('narpio', u"Närpiö"),
|
||||||
|
('oravainen', u"Oravainen"),
|
||||||
|
('orimattila', u"Orimattila"),
|
||||||
|
('oripaa', u"Oripää"),
|
||||||
|
('orivesi', u"Orivesi"),
|
||||||
|
('oulainen', u"Oulainen"),
|
||||||
|
('oulu', u"Oulu"),
|
||||||
|
('oulunsalo', u"Oulunsalo"),
|
||||||
|
('outokumpu', u"Outokumpu"),
|
||||||
|
('padasjoki', u"Padasjoki"),
|
||||||
|
('paimio', u"Paimio"),
|
||||||
|
('paltamo', u"Paltamo"),
|
||||||
|
('parainen', u"Parainen"),
|
||||||
|
('parikkala', u"Parikkala"),
|
||||||
|
('parkano', u"Parkano"),
|
||||||
|
('pedersore', u"Pedersöre"),
|
||||||
|
('pelkosenniemi', u"Pelkosenniemi"),
|
||||||
|
('pello', u"Pello"),
|
||||||
|
('perho', u"Perho"),
|
||||||
|
('pernaja', u"Pernaja"),
|
||||||
|
('pernio', u"Perniö"),
|
||||||
|
('pertteli', u"Pertteli"),
|
||||||
|
('pertunmaa', u"Pertunmaa"),
|
||||||
|
('petajavesi', u"Petäjävesi"),
|
||||||
|
('pieksamaki', u"Pieksämäki"),
|
||||||
|
('pielavesi', u"Pielavesi"),
|
||||||
|
('pietarsaari', u"Pietarsaari"),
|
||||||
|
('pihtipudas', u"Pihtipudas"),
|
||||||
|
('piikkio', u"Piikkiö"),
|
||||||
|
('piippola', u"Piippola"),
|
||||||
|
('pirkkala', u"Pirkkala"),
|
||||||
|
('pohja', u"Pohja"),
|
||||||
|
('polvijarvi', u"Polvijärvi"),
|
||||||
|
('pomarkku', u"Pomarkku"),
|
||||||
|
('pori', u"Pori"),
|
||||||
|
('pornainen', u"Pornainen"),
|
||||||
|
('porvoo', u"Porvoo"),
|
||||||
|
('posio', u"Posio"),
|
||||||
|
('pudasjarvi', u"Pudasjärvi"),
|
||||||
|
('pukkila', u"Pukkila"),
|
||||||
|
('pulkkila', u"Pulkkila"),
|
||||||
|
('punkaharju', u"Punkaharju"),
|
||||||
|
('punkalaidun', u"Punkalaidun"),
|
||||||
|
('puolanka', u"Puolanka"),
|
||||||
|
('puumala', u"Puumala"),
|
||||||
|
('pyhtaa', u"Pyhtää"),
|
||||||
|
('pyhajoki', u"Pyhäjoki"),
|
||||||
|
('pyhajarvi', u"Pyhäjärvi"),
|
||||||
|
('pyhanta', u"Pyhäntä"),
|
||||||
|
('pyharanta', u"Pyhäranta"),
|
||||||
|
('pyhaselka', u"Pyhäselkä"),
|
||||||
|
('pylkonmaki', u"Pylkönmäki"),
|
||||||
|
('palkane', u"Pälkäne"),
|
||||||
|
('poytya', u"Pöytyä"),
|
||||||
|
('raahe', u"Raahe"),
|
||||||
|
('raisio', u"Raisio"),
|
||||||
|
('rantasalmi', u"Rantasalmi"),
|
||||||
|
('rantsila', u"Rantsila"),
|
||||||
|
('ranua', u"Ranua"),
|
||||||
|
('rauma', u"Rauma"),
|
||||||
|
('rautalampi', u"Rautalampi"),
|
||||||
|
('rautavaara', u"Rautavaara"),
|
||||||
|
('rautjarvi', u"Rautjärvi"),
|
||||||
|
('reisjarvi', u"Reisjärvi"),
|
||||||
|
('renko', u"Renko"),
|
||||||
|
('riihimaki', u"Riihimäki"),
|
||||||
|
('ristiina', u"Ristiina"),
|
||||||
|
('ristijarvi', u"Ristijärvi"),
|
||||||
|
('rovaniemi', u"Rovaniemi"),
|
||||||
|
('ruokolahti', u"Ruokolahti"),
|
||||||
|
('ruotsinpyhtaa', u"Ruotsinpyhtää"),
|
||||||
|
('ruovesi', u"Ruovesi"),
|
||||||
|
('rusko', u"Rusko"),
|
||||||
|
('rymattyla', u"Rymättylä"),
|
||||||
|
('raakkyla', u"Rääkkylä"),
|
||||||
|
('saarijarvi', u"Saarijärvi"),
|
||||||
|
('salla', u"Salla"),
|
||||||
|
('salo', u"Salo"),
|
||||||
|
('saltvik', u"Saltvik"),
|
||||||
|
('sammatti', u"Sammatti"),
|
||||||
|
('sauvo', u"Sauvo"),
|
||||||
|
('savitaipale', u"Savitaipale"),
|
||||||
|
('savonlinna', u"Savonlinna"),
|
||||||
|
('savonranta', u"Savonranta"),
|
||||||
|
('savukoski', u"Savukoski"),
|
||||||
|
('seinajoki', u"Seinäjoki"),
|
||||||
|
('sievi', u"Sievi"),
|
||||||
|
('siikainen', u"Siikainen"),
|
||||||
|
('siikajoki', u"Siikajoki"),
|
||||||
|
('siilinjarvi', u"Siilinjärvi"),
|
||||||
|
('simo', u"Simo"),
|
||||||
|
('sipoo', u"Sipoo"),
|
||||||
|
('siuntio', u"Siuntio"),
|
||||||
|
('sodankyla', u"Sodankylä"),
|
||||||
|
('soini', u"Soini"),
|
||||||
|
('somero', u"Somero"),
|
||||||
|
('sonkajarvi', u"Sonkajärvi"),
|
||||||
|
('sotkamo', u"Sotkamo"),
|
||||||
|
('sottunga', u"Sottunga"),
|
||||||
|
('sulkava', u"Sulkava"),
|
||||||
|
('sund', u"Sund"),
|
||||||
|
('suomenniemi', u"Suomenniemi"),
|
||||||
|
('suomusjarvi', u"Suomusjärvi"),
|
||||||
|
('suomussalmi', u"Suomussalmi"),
|
||||||
|
('suonenjoki', u"Suonenjoki"),
|
||||||
|
('sysma', u"Sysmä"),
|
||||||
|
('sakyla', u"Säkylä"),
|
||||||
|
('sarkisalo', u"Särkisalo"),
|
||||||
|
('taipalsaari', u"Taipalsaari"),
|
||||||
|
('taivalkoski', u"Taivalkoski"),
|
||||||
|
('taivassalo', u"Taivassalo"),
|
||||||
|
('tammela', u"Tammela"),
|
||||||
|
('tammisaari', u"Tammisaari"),
|
||||||
|
('tampere', u"Tampere"),
|
||||||
|
('tarvasjoki', u"Tarvasjoki"),
|
||||||
|
('tervo', u"Tervo"),
|
||||||
|
('tervola', u"Tervola"),
|
||||||
|
('teuva', u"Teuva"),
|
||||||
|
('tohmajarvi', u"Tohmajärvi"),
|
||||||
|
('toholampi', u"Toholampi"),
|
||||||
|
('toivakka', u"Toivakka"),
|
||||||
|
('tornio', u"Tornio"),
|
||||||
|
('turku', u"Turku"),
|
||||||
|
('tuulos', u"Tuulos"),
|
||||||
|
('tuusniemi', u"Tuusniemi"),
|
||||||
|
('tuusula', u"Tuusula"),
|
||||||
|
('tyrnava', u"Tyrnävä"),
|
||||||
|
('toysa', u"Töysä"),
|
||||||
|
('ullava', u"Ullava"),
|
||||||
|
('ulvila', u"Ulvila"),
|
||||||
|
('urjala', u"Urjala"),
|
||||||
|
('utajarvi', u"Utajärvi"),
|
||||||
|
('utsjoki', u"Utsjoki"),
|
||||||
|
('uurainen', u"Uurainen"),
|
||||||
|
('uusikaarlepyy', u"Uusikaarlepyy"),
|
||||||
|
('uusikaupunki', u"Uusikaupunki"),
|
||||||
|
('vaala', u"Vaala"),
|
||||||
|
('vaasa', u"Vaasa"),
|
||||||
|
('vahto', u"Vahto"),
|
||||||
|
('valkeakoski', u"Valkeakoski"),
|
||||||
|
('valkeala', u"Valkeala"),
|
||||||
|
('valtimo', u"Valtimo"),
|
||||||
|
('vammala', u"Vammala"),
|
||||||
|
('vampula', u"Vampula"),
|
||||||
|
('vantaa', u"Vantaa"),
|
||||||
|
('varkaus', u"Varkaus"),
|
||||||
|
('varpaisjarvi', u"Varpaisjärvi"),
|
||||||
|
('vehmaa', u"Vehmaa"),
|
||||||
|
('velkua', u"Velkua"),
|
||||||
|
('vesanto', u"Vesanto"),
|
||||||
|
('vesilahti', u"Vesilahti"),
|
||||||
|
('veteli', u"Veteli"),
|
||||||
|
('vierema', u"Vieremä"),
|
||||||
|
('vihanti', u"Vihanti"),
|
||||||
|
('vihti', u"Vihti"),
|
||||||
|
('viitasaari', u"Viitasaari"),
|
||||||
|
('vilppula', u"Vilppula"),
|
||||||
|
('vimpeli', u"Vimpeli"),
|
||||||
|
('virolahti', u"Virolahti"),
|
||||||
|
('virrat', u"Virrat"),
|
||||||
|
('vardo', u"Vårdö"),
|
||||||
|
('vahakyro', u"Vähäkyrö"),
|
||||||
|
('vastanfjard', u"Västanfjärd"),
|
||||||
|
('voyri-maksamaa', u"Vöyri-Maksamaa"),
|
||||||
|
('yliharma', u"Ylihärmä"),
|
||||||
|
('yli-ii', u"Yli-Ii"),
|
||||||
|
('ylikiiminki', u"Ylikiiminki"),
|
||||||
|
('ylistaro', u"Ylistaro"),
|
||||||
|
('ylitornio', u"Ylitornio"),
|
||||||
|
('ylivieska', u"Ylivieska"),
|
||||||
|
('ylamaa', u"Ylämaa"),
|
||||||
|
('ylane', u"Yläne"),
|
||||||
|
('ylojarvi', u"Ylöjärvi"),
|
||||||
|
('ypaja', u"Ypäjä"),
|
||||||
|
('aetsa', u"Äetsä"),
|
||||||
|
('ahtari', u"Ähtäri"),
|
||||||
|
('aanekoski', u"Äänekoski")
|
||||||
|
)
|
47
django/contrib/localflavor/fi/forms.py
Normal file
47
django/contrib/localflavor/fi/forms.py
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
"""
|
||||||
|
FI-specific Form helpers
|
||||||
|
"""
|
||||||
|
|
||||||
|
import re
|
||||||
|
from django.newforms import ValidationError
|
||||||
|
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
|
||||||
|
from django.utils.translation import gettext
|
||||||
|
|
||||||
|
class FIZipCodeField(RegexField):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(FIZipCodeField, self).__init__(r'^\d{5}$',
|
||||||
|
max_length=None, min_length=None,
|
||||||
|
error_message=gettext(u'Enter a zip code in the format XXXXX.'),
|
||||||
|
*args, **kwargs)
|
||||||
|
|
||||||
|
class FIMunicipalitySelect(Select):
|
||||||
|
"""
|
||||||
|
A Select widget that uses a list of Finnish municipalities as its choices.
|
||||||
|
"""
|
||||||
|
def __init__(self, attrs=None):
|
||||||
|
from fi_municipalities import MUNICIPALITY_CHOICES # relative import
|
||||||
|
super(FIMunicipalitySelect, self).__init__(attrs, choices=MUNICIPALITY_CHOICES)
|
||||||
|
|
||||||
|
class FISocialSecurityNumber(Field):
|
||||||
|
def clean(self, value):
|
||||||
|
super(FISocialSecurityNumber, self).clean(value)
|
||||||
|
if value in EMPTY_VALUES:
|
||||||
|
return u''
|
||||||
|
|
||||||
|
checkmarks = "0123456789ABCDEFHJKLMNPRSTUVWXY"
|
||||||
|
result = re.match(r"""^
|
||||||
|
(?P<date>([0-2]\d|3[01])
|
||||||
|
(0\d|1[012])
|
||||||
|
(\d{2}))
|
||||||
|
[A+-]
|
||||||
|
(?P<serial>(\d{3}))
|
||||||
|
(?P<chechsum>[%s])$""" % checkmarks, value, re.VERBOSE | re.IGNORECASE)
|
||||||
|
if not result:
|
||||||
|
raise ValidationError(gettext(u'Enter a valid Finnish social security number.'))
|
||||||
|
checksum = int(result.groupdict()['date'] + result.groupdict()['serial'])
|
||||||
|
|
||||||
|
if checkmarks[checksum % len(checkmarks)] == result.groupdict()['chechsum'].upper():
|
||||||
|
return u'%s' % value.upper()
|
||||||
|
|
||||||
|
raise ValidationError(gettext(u'Enter a valid Finnish social security number.'))
|
||||||
|
|
@ -4,7 +4,7 @@ FR-specific Form helpers
|
|||||||
|
|
||||||
from django.newforms import ValidationError
|
from django.newforms import ValidationError
|
||||||
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
|
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
|
||||||
from django.newforms.util import smart_unicode
|
from django.utils.encoding import smart_unicode
|
||||||
from django.utils.translation import gettext
|
from django.utils.translation import gettext
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
0
django/contrib/localflavor/it/__init__.py
Normal file
0
django/contrib/localflavor/it/__init__.py
Normal file
31
django/contrib/localflavor/it/forms.py
Normal file
31
django/contrib/localflavor/it/forms.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
"""
|
||||||
|
IT-specific Form helpers
|
||||||
|
"""
|
||||||
|
|
||||||
|
from django.newforms import ValidationError
|
||||||
|
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
|
||||||
|
from django.utils.translation import gettext
|
||||||
|
import re
|
||||||
|
|
||||||
|
class ITZipCodeField(RegexField):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(ITZipCodeField, self).__init__(r'^\d{5}$',
|
||||||
|
max_length=None, min_length=None,
|
||||||
|
error_message=gettext(u'Enter a zip code in the format XXXXX.'),
|
||||||
|
*args, **kwargs)
|
||||||
|
|
||||||
|
class ITRegionSelect(Select):
|
||||||
|
"""
|
||||||
|
A Select widget that uses a list of IT regions as its choices.
|
||||||
|
"""
|
||||||
|
def __init__(self, attrs=None):
|
||||||
|
from it_region import REGION_CHOICES # relative import
|
||||||
|
super(ITRegionSelect, self).__init__(attrs, choices=REGION_CHOICES)
|
||||||
|
|
||||||
|
class ITProvinceSelect(Select):
|
||||||
|
"""
|
||||||
|
A Select widget that uses a list of IT regions as its choices.
|
||||||
|
"""
|
||||||
|
def __init__(self, attrs=None):
|
||||||
|
from it_province import PROVINCE_CHOICES # relative import
|
||||||
|
super(ITProvinceSelect, self).__init__(attrs, choices=PROVINCE_CHOICES)
|
114
django/contrib/localflavor/it/it_province.py
Normal file
114
django/contrib/localflavor/it/it_province.py
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
# -*- coding: utf-8 -*
|
||||||
|
|
||||||
|
PROVINCE_CHOICES = (
|
||||||
|
('AG', 'Agrigento'),
|
||||||
|
('AL', 'Alessandria'),
|
||||||
|
('AN', 'Ancona'),
|
||||||
|
('AO', 'Aosta'),
|
||||||
|
('AR', 'Arezzo'),
|
||||||
|
('AP', 'Ascoli Piceno'),
|
||||||
|
('AT', 'Asti'),
|
||||||
|
('AV', 'Avellino'),
|
||||||
|
('BA', 'Bari'),
|
||||||
|
# ('BT', 'Barletta-Andria-Trani'), # active starting from 2009
|
||||||
|
('BL', 'Belluno'),
|
||||||
|
('BN', 'Benevento'),
|
||||||
|
('BG', 'Bergamo'),
|
||||||
|
('BI', 'Biella'),
|
||||||
|
('BO', 'Bologna'),
|
||||||
|
('BZ', 'Bolzano/Bozen'),
|
||||||
|
('BS', 'Brescia'),
|
||||||
|
('BR', 'Brindisi'),
|
||||||
|
('CA', 'Cagliari'),
|
||||||
|
('CL', 'Caltanissetta'),
|
||||||
|
('CB', 'Campobasso'),
|
||||||
|
('CI', 'Carbonia-Iglesias'),
|
||||||
|
('CE', 'Caserta'),
|
||||||
|
('CT', 'Catania'),
|
||||||
|
('CZ', 'Catanzaro'),
|
||||||
|
('CH', 'Chieti'),
|
||||||
|
('CO', 'Como'),
|
||||||
|
('CS', 'Cosenza'),
|
||||||
|
('CR', 'Cremona'),
|
||||||
|
('KR', 'Crotone'),
|
||||||
|
('CN', 'Cuneo'),
|
||||||
|
('EN', 'Enna'),
|
||||||
|
# ('FM', 'Fermo'), # active starting from 2009
|
||||||
|
('FE', 'Ferrara'),
|
||||||
|
('FI', 'Firenze'),
|
||||||
|
('FG', 'Foggia'),
|
||||||
|
('FC', 'Forlì-Cesena'),
|
||||||
|
('FR', 'Frosinone'),
|
||||||
|
('GE', 'Genova'),
|
||||||
|
('GO', 'Gorizia'),
|
||||||
|
('GR', 'Grosseto'),
|
||||||
|
('IM', 'Imperia'),
|
||||||
|
('IS', 'Isernia'),
|
||||||
|
('SP', 'La Spezia'),
|
||||||
|
('AQ', u'L’Acquila'),
|
||||||
|
('LT', 'Latina'),
|
||||||
|
('LE', 'Lecce'),
|
||||||
|
('LC', 'Lecco'),
|
||||||
|
('LI', 'Livorno'),
|
||||||
|
('LO', 'Lodi'),
|
||||||
|
('LU', 'Lucca'),
|
||||||
|
('MC', 'Macerata'),
|
||||||
|
('MN', 'Mantova'),
|
||||||
|
('MS', 'Massa-Carrara'),
|
||||||
|
('MT', 'Matera'),
|
||||||
|
('VS', 'Medio Campidano'),
|
||||||
|
('ME', 'Messina'),
|
||||||
|
('MI', 'Milano'),
|
||||||
|
('MO', 'Modena'),
|
||||||
|
# ('MB', 'Monza e Brianza'), # active starting from 2009
|
||||||
|
('NA', 'Napoli'),
|
||||||
|
('NO', 'Novara'),
|
||||||
|
('NU', 'Nuoro'),
|
||||||
|
('OG', 'Ogliastra'),
|
||||||
|
('OT', 'Olbia-Tempio'),
|
||||||
|
('OR', 'Oristano'),
|
||||||
|
('PD', 'Padova'),
|
||||||
|
('PA', 'Palermo'),
|
||||||
|
('PR', 'Parma'),
|
||||||
|
('PV', 'Pavia'),
|
||||||
|
('PG', 'Perugia'),
|
||||||
|
('PU', 'Pesaro e Urbino'),
|
||||||
|
('PE', 'Pescara'),
|
||||||
|
('PC', 'Piacenza'),
|
||||||
|
('PI', 'Pisa'),
|
||||||
|
('PT', 'Pistoia'),
|
||||||
|
('PN', 'Pordenone'),
|
||||||
|
('PZ', 'Potenza'),
|
||||||
|
('PO', 'Prato'),
|
||||||
|
('RG', 'Ragusa'),
|
||||||
|
('RA', 'Ravenna'),
|
||||||
|
('RC', 'Reggio Calabria'),
|
||||||
|
('RE', 'Reggio Emilia'),
|
||||||
|
('RI', 'Rieti'),
|
||||||
|
('RN', 'Rimini')
|
||||||
|
('RM', 'Roma'),
|
||||||
|
('RO', 'Rovigo'),
|
||||||
|
('SA', 'Salerno'),
|
||||||
|
('SS', 'Sassari'),
|
||||||
|
('SV', 'Savona'),
|
||||||
|
('SI', 'Siena'),
|
||||||
|
('SR', 'Siracusa'),
|
||||||
|
('SO', 'Sondrio'),
|
||||||
|
('TA', 'Taranto'),
|
||||||
|
('TE', 'Teramo'),
|
||||||
|
('TR', 'Terni'),
|
||||||
|
('TO', 'Torino'),
|
||||||
|
('TP', 'Trapani'),
|
||||||
|
('TN', 'Trento'),
|
||||||
|
('TV', 'Treviso'),
|
||||||
|
('TS', 'Trieste'),
|
||||||
|
('UD', 'Udine'),
|
||||||
|
('VA', 'Varese'),
|
||||||
|
('VE', 'Venezia'),
|
||||||
|
('VB', 'Verbano Cusio Ossola'),
|
||||||
|
('VC', 'Vercelli'),
|
||||||
|
('VR', 'Verona'),
|
||||||
|
('VV', 'Vibo Valentia'),
|
||||||
|
('VI', 'Vicenza'),
|
||||||
|
('VT', 'Viterbo'),
|
||||||
|
)
|
24
django/contrib/localflavor/it/it_region.py
Normal file
24
django/contrib/localflavor/it/it_region.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# -*- coding: utf-8 -*
|
||||||
|
|
||||||
|
REGION_CHOICES = (
|
||||||
|
('ABR', 'Abruzzo'),
|
||||||
|
('BAS', 'Basilicata'),
|
||||||
|
('CAL', 'Calabria'),
|
||||||
|
('CAM', 'Campania'),
|
||||||
|
('EMR', 'Emilia-Romagna'),
|
||||||
|
('FVG', 'Friuli-Venezia Giulia'),
|
||||||
|
('LAZ', 'Lazio'),
|
||||||
|
('LIG', 'Liguria'),
|
||||||
|
('LOM', 'Lombardia'),
|
||||||
|
('MAR', 'Marche'),
|
||||||
|
('MOL', 'Molise'),
|
||||||
|
('PMN', 'Piemonte'),
|
||||||
|
('PUG', 'Puglia'),
|
||||||
|
('SAR', 'Sardegna'),
|
||||||
|
('SIC', 'Sicilia'),
|
||||||
|
('TOS', 'Toscana'),
|
||||||
|
('TAA', 'Trentino-Alto Adige'),
|
||||||
|
('UMB', 'Umbria'),
|
||||||
|
('VAO', u'Valle d’Aosta'),
|
||||||
|
('VEN', 'Veneto'),
|
||||||
|
)
|
0
django/contrib/localflavor/no/__init__.py
Normal file
0
django/contrib/localflavor/no/__init__.py
Normal file
77
django/contrib/localflavor/no/forms.py
Normal file
77
django/contrib/localflavor/no/forms.py
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
# -*- coding: iso-8859-1 -*-
|
||||||
|
"""
|
||||||
|
Norwegian-specific Form helpers
|
||||||
|
"""
|
||||||
|
|
||||||
|
import re, datetime
|
||||||
|
from django.newforms import ValidationError
|
||||||
|
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
|
||||||
|
from django.utils.translation import gettext
|
||||||
|
|
||||||
|
class NOZipCodeField(RegexField):
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super(NOZipCodeField, self).__init__(r'^\d{4}$',
|
||||||
|
max_length=None, min_length=None,
|
||||||
|
error_message=gettext(u'Enter a zip code in the format XXXX.'),
|
||||||
|
*args, **kwargs)
|
||||||
|
|
||||||
|
class NOMunicipalitySelect(Select):
|
||||||
|
"""
|
||||||
|
A Select widget that uses a list of Norwegian municipalities (fylker)
|
||||||
|
as its choices.
|
||||||
|
"""
|
||||||
|
def __init__(self, attrs=None):
|
||||||
|
from no_municipalities import MUNICIPALITY_CHOICES
|
||||||
|
super(NOMunicipalitySelect, self).__init__(attrs, choices=MUNICIPALITY_CHOICES)
|
||||||
|
|
||||||
|
class NOSocialSecurityNumber(Field):
|
||||||
|
"""
|
||||||
|
Algorithm is documented at http://no.wikipedia.org/wiki/Personnummer
|
||||||
|
"""
|
||||||
|
def clean(self, value):
|
||||||
|
super(NOSocialSecurityNumber, self).clean(value)
|
||||||
|
if value in EMPTY_VALUES:
|
||||||
|
return u''
|
||||||
|
|
||||||
|
msg = gettext(u'Enter a valid Norwegian social security number.')
|
||||||
|
if not re.match(r'^\d{11}$', value):
|
||||||
|
raise ValidationError(msg)
|
||||||
|
|
||||||
|
day = int(value[:2])
|
||||||
|
month = int(value[2:4])
|
||||||
|
year2 = int(value[4:6])
|
||||||
|
|
||||||
|
inum = int(value[6:9])
|
||||||
|
self.birthday = None
|
||||||
|
try:
|
||||||
|
if 000 <= inum < 500:
|
||||||
|
self.birthday = datetime.date(1900+year2, month, day)
|
||||||
|
if 500 <= inum < 750 and year2 > 54:
|
||||||
|
self.birthday = datetime.date(1800+year2, month, day)
|
||||||
|
if 500 <= inum < 1000 and year2 < 40:
|
||||||
|
self.birthday = datetime.date(2000+year2, month, day)
|
||||||
|
if 900 <= inum < 1000 and year2 > 39:
|
||||||
|
self.birthday = datetime.date(1900+year2, month, day)
|
||||||
|
except ValueError:
|
||||||
|
raise ValidationError(msg)
|
||||||
|
|
||||||
|
sexnum = int(value[8])
|
||||||
|
if sexnum % 2 == 0:
|
||||||
|
self.gender = 'F'
|
||||||
|
else:
|
||||||
|
self.gender = 'M'
|
||||||
|
|
||||||
|
digits = map(int, list(value))
|
||||||
|
weight_1 = [3, 7, 6, 1, 8, 9, 4, 5, 2, 1, 0]
|
||||||
|
weight_2 = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2, 1]
|
||||||
|
|
||||||
|
def multiply_reduce(aval, bval):
|
||||||
|
return sum((a * b) for (a, b) in zip(aval, bval))
|
||||||
|
|
||||||
|
if multiply_reduce(digits, weight_1) % 11 != 0:
|
||||||
|
raise ValidationError(msg)
|
||||||
|
if multiply_reduce(digits, weight_2) % 11 != 0:
|
||||||
|
raise ValidationError(msg)
|
||||||
|
|
||||||
|
return value
|
||||||
|
|
32
django/contrib/localflavor/no/no_municipalities.py
Normal file
32
django/contrib/localflavor/no/no_municipalities.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# -*- coding: iso-8859-1 -*-
|
||||||
|
"""
|
||||||
|
An alphabetical list of Norwegian municipalities (fylker) fro use as `choices`
|
||||||
|
in a formfield.
|
||||||
|
|
||||||
|
This exists in this standalone file so that it's on ly imported into memory
|
||||||
|
when explicitly needed.
|
||||||
|
"""
|
||||||
|
|
||||||
|
MUNICIPALITY_CHOICES = (
|
||||||
|
('akershus', u'Akershus'),
|
||||||
|
('austagder', u'Aust-Agder'),
|
||||||
|
('buskerud', u'Buskerud'),
|
||||||
|
('finnmark', u'Finnmark'),
|
||||||
|
('hedmark', u'Hedmark'),
|
||||||
|
('hordaland', u'Hordaland'),
|
||||||
|
('janmayen', u'Jan Mayen'),
|
||||||
|
('moreogromsdal', u'Møre og Romsdal'),
|
||||||
|
('nordtrondelag', u'Nord-Trøndelag'),
|
||||||
|
('nordland', u'Nordland'),
|
||||||
|
('oppland', u'Oppland'),
|
||||||
|
('oslo', u'Oslo'),
|
||||||
|
('rogaland', u'Rogaland'),
|
||||||
|
('sognogfjordane', u'Sogn og Fjordane'),
|
||||||
|
('svalbard', u'Svalbard'),
|
||||||
|
('sortrondelag', u'Sør-Trøndelag'),
|
||||||
|
('telemark', u'Telemark'),
|
||||||
|
('troms', u'Troms'),
|
||||||
|
('vestagder', u'Vest-Agder'),
|
||||||
|
('vestfold', u'Vestfold'),
|
||||||
|
('ostfold', u'Østfold')
|
||||||
|
)
|
@ -4,11 +4,12 @@ USA-specific Form helpers
|
|||||||
|
|
||||||
from django.newforms import ValidationError
|
from django.newforms import ValidationError
|
||||||
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
|
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
|
||||||
from django.newforms.util import smart_unicode
|
from django.utils.encoding import smart_unicode
|
||||||
from django.utils.translation import gettext
|
from django.utils.translation import gettext
|
||||||
import re
|
import re
|
||||||
|
|
||||||
phone_digits_re = re.compile(r'^(?:1-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$')
|
phone_digits_re = re.compile(r'^(?:1-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$')
|
||||||
|
ssn_re = re.compile(r"^(?P<area>\d{3})[-\ ]?(?P<group>\d{2})[-\ ]?(?P<serial>\d{4})$")
|
||||||
|
|
||||||
class USZipCodeField(RegexField):
|
class USZipCodeField(RegexField):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -28,6 +29,45 @@ class USPhoneNumberField(Field):
|
|||||||
return u'%s-%s-%s' % (m.group(1), m.group(2), m.group(3))
|
return u'%s-%s-%s' % (m.group(1), m.group(2), m.group(3))
|
||||||
raise ValidationError(u'Phone numbers must be in XXX-XXX-XXXX format.')
|
raise ValidationError(u'Phone numbers must be in XXX-XXX-XXXX format.')
|
||||||
|
|
||||||
|
class USSocialSecurityNumberField(Field):
|
||||||
|
"""
|
||||||
|
A United States Social Security number.
|
||||||
|
|
||||||
|
Checks the following rules to determine whether the number is valid:
|
||||||
|
|
||||||
|
* Conforms to the XXX-XX-XXXX format.
|
||||||
|
* No group consists entirely of zeroes.
|
||||||
|
* The leading group is not "666" (block "666" will never be allocated).
|
||||||
|
* The number is not in the promotional block 987-65-4320 through 987-65-4329,
|
||||||
|
which are permanently invalid.
|
||||||
|
* The number is not one known to be invalid due to otherwise widespread
|
||||||
|
promotional use or distribution (e.g., the Woolworth's number or the 1962
|
||||||
|
promotional number).
|
||||||
|
"""
|
||||||
|
def clean(self, value):
|
||||||
|
super(USSocialSecurityNumberField, self).clean(value)
|
||||||
|
if value in EMPTY_VALUES:
|
||||||
|
return u''
|
||||||
|
msg = gettext(u'Enter a valid U.S. Social Security number in XXX-XX-XXXX format.')
|
||||||
|
match = re.match(ssn_re, value)
|
||||||
|
if not match:
|
||||||
|
raise ValidationError(msg)
|
||||||
|
area, group, serial = match.groupdict()['area'], match.groupdict()['group'], match.groupdict()['serial']
|
||||||
|
|
||||||
|
# First pass: no blocks of all zeroes.
|
||||||
|
if area == '000' or \
|
||||||
|
group == '00' or \
|
||||||
|
serial == '0000':
|
||||||
|
raise ValidationError(msg)
|
||||||
|
|
||||||
|
# Second pass: promotional and otherwise permanently invalid numbers.
|
||||||
|
if area == '666' or \
|
||||||
|
(area == '987' and group == '65' and 4320 <= int(serial) <= 4329) or \
|
||||||
|
value == '078-05-1120' or \
|
||||||
|
value == '219-09-9999':
|
||||||
|
raise ValidationError(msg)
|
||||||
|
return u'%s-%s-%s' % (area, group, serial)
|
||||||
|
|
||||||
class USStateField(Field):
|
class USStateField(Field):
|
||||||
"""
|
"""
|
||||||
A form field that validates its input is a U.S. state name or abbreviation.
|
A form field that validates its input is a U.S. state name or abbreviation.
|
||||||
|
0
django/contrib/webdesign/__init__.py
Normal file
0
django/contrib/webdesign/__init__.py
Normal file
66
django/contrib/webdesign/lorem_ipsum.py
Normal file
66
django/contrib/webdesign/lorem_ipsum.py
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
"""
|
||||||
|
Utility functions for generating "lorem ipsum" Latin text.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import random
|
||||||
|
|
||||||
|
COMMON_P = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
|
||||||
|
WORDS = ('exercitationem', 'perferendis', 'perspiciatis', 'laborum', 'eveniet', 'sunt', 'iure', 'nam', 'nobis', 'eum', 'cum', 'officiis', 'excepturi', 'odio', 'consectetur', 'quasi', 'aut', 'quisquam', 'vel', 'eligendi', 'itaque', 'non', 'odit', 'tempore', 'quaerat', 'dignissimos', 'facilis', 'neque', 'nihil', 'expedita', 'vitae', 'vero', 'ipsum', 'nisi', 'animi', 'cumque', 'pariatur', 'velit', 'modi', 'natus', 'iusto', 'eaque', 'sequi', 'illo', 'sed', 'ex', 'et', 'voluptatibus', 'tempora', 'veritatis', 'ratione', 'assumenda', 'incidunt', 'nostrum', 'placeat', 'aliquid', 'fuga', 'provident', 'praesentium', 'rem', 'necessitatibus', 'suscipit', 'adipisci', 'quidem', 'possimus', 'voluptas', 'debitis', 'sint', 'accusantium', 'unde', 'sapiente', 'voluptate', 'qui', 'aspernatur', 'laudantium', 'soluta', 'amet', 'quo', 'aliquam', 'saepe', 'culpa', 'libero', 'ipsa', 'dicta', 'reiciendis', 'nesciunt', 'doloribus', 'autem', 'impedit', 'minima', 'maiores', 'repudiandae', 'ipsam', 'obcaecati', 'ullam', 'enim', 'totam', 'delectus', 'ducimus', 'quis', 'voluptates', 'dolores', 'molestiae', 'harum', 'dolorem', 'quia', 'voluptatem', 'molestias', 'magni', 'distinctio', 'omnis', 'illum', 'dolorum', 'voluptatum', 'ea', 'quas', 'quam', 'corporis', 'quae', 'blanditiis', 'atque', 'deserunt', 'laboriosam', 'earum', 'consequuntur', 'hic', 'cupiditate', 'quibusdam', 'accusamus', 'ut', 'rerum', 'error', 'minus', 'eius', 'ab', 'ad', 'nemo', 'fugit', 'officia', 'at', 'in', 'id', 'quos', 'reprehenderit', 'numquam', 'iste', 'fugiat', 'sit', 'inventore', 'beatae', 'repellendus', 'magnam', 'recusandae', 'quod', 'explicabo', 'doloremque', 'aperiam', 'consequatur', 'asperiores', 'commodi', 'optio', 'dolor', 'labore', 'temporibus', 'repellat', 'veniam', 'architecto', 'est', 'esse', 'mollitia', 'nulla', 'a', 'similique', 'eos', 'alias', 'dolore', 'tenetur', 'deleniti', 'porro', 'facere', 'maxime', 'corrupti')
|
||||||
|
COMMON_WORDS = ('lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur', 'adipisicing', 'elit', 'sed', 'do', 'eiusmod', 'tempor', 'incididunt', 'ut', 'labore', 'et', 'dolore', 'magna', 'aliqua')
|
||||||
|
|
||||||
|
def sentence():
|
||||||
|
"""
|
||||||
|
Returns a randomly generated sentence of lorem ipsum text.
|
||||||
|
|
||||||
|
The first word is capitalized, and the sentence ends in either a period or
|
||||||
|
question mark. Commas are added at random.
|
||||||
|
"""
|
||||||
|
# Determine the number of comma-separated sections and number of words in
|
||||||
|
# each section for this sentence.
|
||||||
|
sections = [' '.join(random.sample(WORDS, random.randint(3, 12))) for i in range(random.randint(1, 5))]
|
||||||
|
s = ', '.join(sections)
|
||||||
|
# Convert to sentence case and add end punctuation.
|
||||||
|
return '%s%s%s' % (s[0].upper(), s[1:], random.choice('?.'))
|
||||||
|
|
||||||
|
def paragraph():
|
||||||
|
"""
|
||||||
|
Returns a randomly generated paragraph of lorem ipsum text.
|
||||||
|
|
||||||
|
The paragraph consists of between 1 and 4 sentences, inclusive.
|
||||||
|
"""
|
||||||
|
return ' '.join([sentence() for i in range(random.randint(1, 4))])
|
||||||
|
|
||||||
|
def paragraphs(count, common=True):
|
||||||
|
"""
|
||||||
|
Returns a list of paragraphs as returned by paragraph().
|
||||||
|
|
||||||
|
If `common` is True, then the first paragraph will be the standard
|
||||||
|
'lorem ipsum' paragraph. Otherwise, the first paragraph will be random
|
||||||
|
Latin text. Either way, subsequent paragraphs will be random Latin text.
|
||||||
|
"""
|
||||||
|
paras = []
|
||||||
|
for i in range(count):
|
||||||
|
if common and i == 0:
|
||||||
|
paras.append(COMMON_P)
|
||||||
|
else:
|
||||||
|
paras.append(paragraph())
|
||||||
|
return paras
|
||||||
|
|
||||||
|
def words(count, common=True):
|
||||||
|
"""
|
||||||
|
Returns a string of `count` lorem ipsum words separated by a single space.
|
||||||
|
|
||||||
|
If `common` is True, then the first 19 words will be the standard
|
||||||
|
'lorem ipsum' words. Otherwise, all words will be selected randomly.
|
||||||
|
"""
|
||||||
|
if common:
|
||||||
|
word_list = list(COMMON_WORDS)
|
||||||
|
else:
|
||||||
|
word_list = []
|
||||||
|
c = len(word_list)
|
||||||
|
if count > c:
|
||||||
|
count = min(count - c, len(WORDS))
|
||||||
|
word_list += random.sample(WORDS, count - c)
|
||||||
|
else:
|
||||||
|
word_list = word_list[:count]
|
||||||
|
return ' '.join(word_list)
|
0
django/contrib/webdesign/templatetags/__init__.py
Normal file
0
django/contrib/webdesign/templatetags/__init__.py
Normal file
67
django/contrib/webdesign/templatetags/webdesign.py
Normal file
67
django/contrib/webdesign/templatetags/webdesign.py
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
from django.contrib.webdesign.lorem_ipsum import words, paragraphs
|
||||||
|
from django import template
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
class LoremNode(template.Node):
|
||||||
|
def __init__(self, count, method, common):
|
||||||
|
self.count, self.method, self.common = count, method, common
|
||||||
|
|
||||||
|
def render(self, context):
|
||||||
|
try:
|
||||||
|
count = int(self.count.resolve(context))
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
count = 1
|
||||||
|
if self.method == 'w':
|
||||||
|
return words(count, common=self.common)
|
||||||
|
else:
|
||||||
|
paras = paragraphs(count, common=self.common)
|
||||||
|
if self.method == 'p':
|
||||||
|
paras = ['<p>%s</p>' % p for p in paras]
|
||||||
|
return '\n\n'.join(paras)
|
||||||
|
|
||||||
|
#@register.tag
|
||||||
|
def lorem(parser, token):
|
||||||
|
"""
|
||||||
|
Creates random Latin text useful for providing test data in templates.
|
||||||
|
|
||||||
|
Usage format::
|
||||||
|
|
||||||
|
{% lorem [count] [method] [random] %}
|
||||||
|
|
||||||
|
``count`` is a number (or variable) containing the number of paragraphs or
|
||||||
|
words to generate (default is 1).
|
||||||
|
|
||||||
|
``method`` is either ``w`` for words, ``p`` for HTML paragraphs, ``b`` for
|
||||||
|
plain-text paragraph blocks (default is ``b``).
|
||||||
|
|
||||||
|
``random`` is the word ``random``, which if given, does not use the common
|
||||||
|
paragraph (starting "Lorem ipsum dolor sit amet, consectetuer...").
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
* ``{% lorem %}`` will output the common "lorem ipsum" paragraph
|
||||||
|
* ``{% lorem 3 p %}`` will output the common "lorem ipsum" paragraph
|
||||||
|
and two random paragraphs each wrapped in HTML ``<p>`` tags
|
||||||
|
* ``{% lorem 2 w random %}`` will output two random latin words
|
||||||
|
"""
|
||||||
|
bits = list(token.split_contents())
|
||||||
|
tagname = bits[0]
|
||||||
|
# Random bit
|
||||||
|
common = bits[-1] != 'random'
|
||||||
|
if not common:
|
||||||
|
bits.pop()
|
||||||
|
# Method bit
|
||||||
|
if bits[-1] in ('w', 'p', 'b'):
|
||||||
|
method = bits.pop()
|
||||||
|
else:
|
||||||
|
method = 'b'
|
||||||
|
# Count bit
|
||||||
|
if len(bits) > 1:
|
||||||
|
count = bits.pop()
|
||||||
|
else:
|
||||||
|
count = '1'
|
||||||
|
count = parser.compile_filter(count)
|
||||||
|
if len(bits) != 1:
|
||||||
|
raise TemplateSyntaxError("Incorrect format for %r tag" % tagname)
|
||||||
|
return LoremNode(count, method, common)
|
||||||
|
lorem = register.tag(lorem)
|
7
django/core/cache/backends/memcached.py
vendored
7
django/core/cache/backends/memcached.py
vendored
@ -3,9 +3,12 @@
|
|||||||
from django.core.cache.backends.base import BaseCache, InvalidCacheBackendError
|
from django.core.cache.backends.base import BaseCache, InvalidCacheBackendError
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import memcache
|
import cmemcache as memcache
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise InvalidCacheBackendError, "Memcached cache backend requires the 'memcache' library"
|
try:
|
||||||
|
import memcache
|
||||||
|
except:
|
||||||
|
raise InvalidCacheBackendError("Memcached cache backend requires either the 'memcache' or 'cmemcache' library")
|
||||||
|
|
||||||
class CacheClass(BaseCache):
|
class CacheClass(BaseCache):
|
||||||
def __init__(self, server, params):
|
def __init__(self, server, params):
|
||||||
|
@ -410,30 +410,10 @@ get_sql_initial_data.help_doc = "RENAMED: see 'sqlcustom'"
|
|||||||
get_sql_initial_data.args = ''
|
get_sql_initial_data.args = ''
|
||||||
|
|
||||||
def get_sql_sequence_reset(app):
|
def get_sql_sequence_reset(app):
|
||||||
"Returns a list of the SQL statements to reset PostgreSQL sequences for the given app."
|
"Returns a list of the SQL statements to reset sequences for the given app."
|
||||||
from django.db import backend, models
|
from django.db import backend, models
|
||||||
output = []
|
return backend.get_sql_sequence_reset(style, models.get_models(app))
|
||||||
for model in models.get_models(app):
|
get_sql_sequence_reset.help_doc = "Prints the SQL statements for resetting sequences for the given app name(s)."
|
||||||
for f in model._meta.fields:
|
|
||||||
if isinstance(f, models.AutoField):
|
|
||||||
output.append("%s setval('%s', (%s max(%s) %s %s));" % \
|
|
||||||
(style.SQL_KEYWORD('SELECT'),
|
|
||||||
style.SQL_FIELD('%s_%s_seq' % (model._meta.db_table, f.column)),
|
|
||||||
style.SQL_KEYWORD('SELECT'),
|
|
||||||
style.SQL_FIELD(backend.quote_name(f.column)),
|
|
||||||
style.SQL_KEYWORD('FROM'),
|
|
||||||
style.SQL_TABLE(backend.quote_name(model._meta.db_table))))
|
|
||||||
break # Only one AutoField is allowed per model, so don't bother continuing.
|
|
||||||
for f in model._meta.many_to_many:
|
|
||||||
output.append("%s setval('%s', (%s max(%s) %s %s));" % \
|
|
||||||
(style.SQL_KEYWORD('SELECT'),
|
|
||||||
style.SQL_FIELD('%s_id_seq' % f.m2m_db_table()),
|
|
||||||
style.SQL_KEYWORD('SELECT'),
|
|
||||||
style.SQL_FIELD(backend.quote_name('id')),
|
|
||||||
style.SQL_KEYWORD('FROM'),
|
|
||||||
style.SQL_TABLE(f.m2m_db_table())))
|
|
||||||
return output
|
|
||||||
get_sql_sequence_reset.help_doc = "Prints the SQL statements for resetting PostgreSQL sequences for the given app name(s)."
|
|
||||||
get_sql_sequence_reset.args = APP_ARGS
|
get_sql_sequence_reset.args = APP_ARGS
|
||||||
|
|
||||||
def get_sql_indexes(app):
|
def get_sql_indexes(app):
|
||||||
@ -456,7 +436,7 @@ def get_sql_indexes_for_model(model):
|
|||||||
unique = f.unique and 'UNIQUE ' or ''
|
unique = f.unique and 'UNIQUE ' or ''
|
||||||
output.append(
|
output.append(
|
||||||
style.SQL_KEYWORD('CREATE %sINDEX' % unique) + ' ' + \
|
style.SQL_KEYWORD('CREATE %sINDEX' % unique) + ' ' + \
|
||||||
style.SQL_TABLE('%s_%s' % (model._meta.db_table, f.column)) + ' ' + \
|
style.SQL_TABLE(backend.quote_name('%s_%s' % (model._meta.db_table, f.column))) + ' ' + \
|
||||||
style.SQL_KEYWORD('ON') + ' ' + \
|
style.SQL_KEYWORD('ON') + ' ' + \
|
||||||
style.SQL_TABLE(backend.quote_name(model._meta.db_table)) + ' ' + \
|
style.SQL_TABLE(backend.quote_name(model._meta.db_table)) + ' ' + \
|
||||||
"(%s);" % style.SQL_FIELD(backend.quote_name(f.column))
|
"(%s);" % style.SQL_FIELD(backend.quote_name(f.column))
|
||||||
@ -1336,12 +1316,13 @@ def load_data(fixture_labels, verbosity=1):
|
|||||||
"Installs the provided fixture file(s) as data in the database."
|
"Installs the provided fixture file(s) as data in the database."
|
||||||
from django.db.models import get_apps
|
from django.db.models import get_apps
|
||||||
from django.core import serializers
|
from django.core import serializers
|
||||||
from django.db import connection, transaction
|
from django.db import connection, transaction, backend
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# Keep a count of the installed objects and fixtures
|
# Keep a count of the installed objects and fixtures
|
||||||
count = [0,0]
|
count = [0,0]
|
||||||
|
models = set()
|
||||||
|
|
||||||
humanize = lambda dirname: dirname and "'%s'" % dirname or 'absolute path'
|
humanize = lambda dirname: dirname and "'%s'" % dirname or 'absolute path'
|
||||||
|
|
||||||
@ -1358,18 +1339,26 @@ def load_data(fixture_labels, verbosity=1):
|
|||||||
|
|
||||||
app_fixtures = [os.path.join(os.path.dirname(app.__file__),'fixtures') for app in get_apps()]
|
app_fixtures = [os.path.join(os.path.dirname(app.__file__),'fixtures') for app in get_apps()]
|
||||||
for fixture_label in fixture_labels:
|
for fixture_label in fixture_labels:
|
||||||
if verbosity > 0:
|
|
||||||
print "Loading '%s' fixtures..." % fixture_label
|
|
||||||
for fixture_dir in app_fixtures + list(settings.FIXTURE_DIRS) + ['']:
|
|
||||||
if verbosity > 1:
|
|
||||||
print "Checking %s for fixtures..." % humanize(fixture_dir)
|
|
||||||
parts = fixture_label.split('.')
|
parts = fixture_label.split('.')
|
||||||
if len(parts) == 1:
|
if len(parts) == 1:
|
||||||
fixture_name = fixture_label
|
fixture_name = fixture_label
|
||||||
formats = serializers.get_serializer_formats()
|
formats = serializers.get_serializer_formats()
|
||||||
else:
|
else:
|
||||||
fixture_name, format = '.'.join(parts[:-1]), parts[-1]
|
fixture_name, format = '.'.join(parts[:-1]), parts[-1]
|
||||||
|
if format in serializers.get_serializer_formats():
|
||||||
formats = [format]
|
formats = [format]
|
||||||
|
else:
|
||||||
|
formats = []
|
||||||
|
|
||||||
|
if verbosity > 0:
|
||||||
|
if formats:
|
||||||
|
print "Loading '%s' fixtures..." % fixture_name
|
||||||
|
else:
|
||||||
|
print "Skipping fixture '%s': %s is not a known serialization format" % (fixture_name, format)
|
||||||
|
|
||||||
|
for fixture_dir in app_fixtures + list(settings.FIXTURE_DIRS) + ['']:
|
||||||
|
if verbosity > 1:
|
||||||
|
print "Checking %s for fixtures..." % humanize(fixture_dir)
|
||||||
|
|
||||||
label_found = False
|
label_found = False
|
||||||
for format in formats:
|
for format in formats:
|
||||||
@ -1396,6 +1385,7 @@ def load_data(fixture_labels, verbosity=1):
|
|||||||
objects = serializers.deserialize(format, fixture)
|
objects = serializers.deserialize(format, fixture)
|
||||||
for obj in objects:
|
for obj in objects:
|
||||||
count[0] += 1
|
count[0] += 1
|
||||||
|
models.add(obj.object.__class__)
|
||||||
obj.save()
|
obj.save()
|
||||||
label_found = True
|
label_found = True
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
@ -1417,6 +1407,12 @@ def load_data(fixture_labels, verbosity=1):
|
|||||||
else:
|
else:
|
||||||
if verbosity > 0:
|
if verbosity > 0:
|
||||||
print "Installed %d object(s) from %d fixture(s)" % tuple(count)
|
print "Installed %d object(s) from %d fixture(s)" % tuple(count)
|
||||||
|
sequence_sql = backend.get_sql_sequence_reset(style, models)
|
||||||
|
if sequence_sql:
|
||||||
|
if verbosity > 1:
|
||||||
|
print "Resetting sequences"
|
||||||
|
for line in sequence_sql:
|
||||||
|
cursor.execute(line)
|
||||||
transaction.commit()
|
transaction.commit()
|
||||||
transaction.leave_transaction_management()
|
transaction.leave_transaction_management()
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""
|
"""
|
||||||
FastCGI server that implements the WSGI protocol.
|
FastCGI (or SCGI, or AJP1.3 ...) server that implements the WSGI protocol.
|
||||||
|
|
||||||
Uses the flup python package: http://www.saddi.com/software/flup/
|
Uses the flup python package: http://www.saddi.com/software/flup/
|
||||||
|
|
||||||
@ -18,15 +18,16 @@ __version__ = "0.1"
|
|||||||
__all__ = ["runfastcgi"]
|
__all__ = ["runfastcgi"]
|
||||||
|
|
||||||
FASTCGI_HELP = r"""runfcgi:
|
FASTCGI_HELP = r"""runfcgi:
|
||||||
Run this project as a fastcgi application. To do this, the
|
Run this project as a fastcgi (or some other protocol supported
|
||||||
flup package from http://www.saddi.com/software/flup/ is
|
by flup) application. To do this, the flup package from
|
||||||
required.
|
http://www.saddi.com/software/flup/ is required.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
django-admin.py runfcgi --settings=yourproject.settings [fcgi settings]
|
django-admin.py runfcgi --settings=yourproject.settings [fcgi settings]
|
||||||
manage.py runfcgi [fcgi settings]
|
manage.py runfcgi [fcgi settings]
|
||||||
|
|
||||||
Optional Fcgi settings: (setting=value)
|
Optional Fcgi settings: (setting=value)
|
||||||
|
protocol=PROTOCOL fcgi, scgi, ajp, ... (default fcgi)
|
||||||
host=HOSTNAME hostname to listen on..
|
host=HOSTNAME hostname to listen on..
|
||||||
port=PORTNUM port to listen on.
|
port=PORTNUM port to listen on.
|
||||||
socket=FILE UNIX socket to listen on.
|
socket=FILE UNIX socket to listen on.
|
||||||
@ -45,8 +46,8 @@ Examples:
|
|||||||
(for webservers which spawn your processes for you)
|
(for webservers which spawn your processes for you)
|
||||||
$ manage.py runfcgi method=threaded
|
$ manage.py runfcgi method=threaded
|
||||||
|
|
||||||
Run a fastcgi server on a TCP host/port
|
Run a scgi server on a TCP host/port
|
||||||
$ manage.py runfcgi method=prefork host=127.0.0.1 port=8025
|
$ manage.py runfcgi protocol=scgi method=prefork host=127.0.0.1 port=8025
|
||||||
|
|
||||||
Run a fastcgi server on a UNIX domain socket (posix platforms only)
|
Run a fastcgi server on a UNIX domain socket (posix platforms only)
|
||||||
$ manage.py runfcgi method=prefork socket=/tmp/fcgi.sock
|
$ manage.py runfcgi method=prefork socket=/tmp/fcgi.sock
|
||||||
@ -58,6 +59,7 @@ Examples:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
FASTCGI_OPTIONS = {
|
FASTCGI_OPTIONS = {
|
||||||
|
'protocol': 'fcgi',
|
||||||
'host': None,
|
'host': None,
|
||||||
'port': None,
|
'port': None,
|
||||||
'socket': None,
|
'socket': None,
|
||||||
@ -100,16 +102,17 @@ def runfastcgi(argset=[], **kwargs):
|
|||||||
print >> sys.stderr, " installed flup, then make sure you have it in your PYTHONPATH."
|
print >> sys.stderr, " installed flup, then make sure you have it in your PYTHONPATH."
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
flup_module = 'server.' + options['protocol']
|
||||||
|
|
||||||
if options['method'] in ('prefork', 'fork'):
|
if options['method'] in ('prefork', 'fork'):
|
||||||
from flup.server.fcgi_fork import WSGIServer
|
|
||||||
wsgi_opts = {
|
wsgi_opts = {
|
||||||
'maxSpare': int(options["maxspare"]),
|
'maxSpare': int(options["maxspare"]),
|
||||||
'minSpare': int(options["minspare"]),
|
'minSpare': int(options["minspare"]),
|
||||||
'maxChildren': int(options["maxchildren"]),
|
'maxChildren': int(options["maxchildren"]),
|
||||||
'maxRequests': int(options["maxrequests"]),
|
'maxRequests': int(options["maxrequests"]),
|
||||||
}
|
}
|
||||||
|
flup_module += '_fork'
|
||||||
elif options['method'] in ('thread', 'threaded'):
|
elif options['method'] in ('thread', 'threaded'):
|
||||||
from flup.server.fcgi import WSGIServer
|
|
||||||
wsgi_opts = {
|
wsgi_opts = {
|
||||||
'maxSpare': int(options["maxspare"]),
|
'maxSpare': int(options["maxspare"]),
|
||||||
'minSpare': int(options["minspare"]),
|
'minSpare': int(options["minspare"]),
|
||||||
@ -120,6 +123,12 @@ def runfastcgi(argset=[], **kwargs):
|
|||||||
|
|
||||||
wsgi_opts['debug'] = False # Turn off flup tracebacks
|
wsgi_opts['debug'] = False # Turn off flup tracebacks
|
||||||
|
|
||||||
|
try:
|
||||||
|
WSGIServer = getattr(__import__('flup.' + flup_module, '', '', flup_module), 'WSGIServer')
|
||||||
|
except:
|
||||||
|
print "Can't import flup." + flup_module
|
||||||
|
return False
|
||||||
|
|
||||||
# Prep up and go
|
# Prep up and go
|
||||||
from django.core.handlers.wsgi import WSGIHandler
|
from django.core.handlers.wsgi import WSGIHandler
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ class MatchChecker(object):
|
|||||||
return str(value) # TODO: Unicode?
|
return str(value) # TODO: Unicode?
|
||||||
|
|
||||||
class RegexURLPattern(object):
|
class RegexURLPattern(object):
|
||||||
def __init__(self, regex, callback, default_args=None):
|
def __init__(self, regex, callback, default_args=None, name=None):
|
||||||
# regex is a string representing a regular expression.
|
# regex is a string representing a regular expression.
|
||||||
# callback is either a string like 'foo.views.news.stories.story_detail'
|
# callback is either a string like 'foo.views.news.stories.story_detail'
|
||||||
# which represents the path to a module and a view function name, or a
|
# which represents the path to a module and a view function name, or a
|
||||||
@ -100,6 +100,7 @@ class RegexURLPattern(object):
|
|||||||
self._callback = None
|
self._callback = None
|
||||||
self._callback_str = callback
|
self._callback_str = callback
|
||||||
self.default_args = default_args or {}
|
self.default_args = default_args or {}
|
||||||
|
self.name = name
|
||||||
|
|
||||||
def resolve(self, path):
|
def resolve(self, path):
|
||||||
match = self.regex.search(path)
|
match = self.regex.search(path)
|
||||||
@ -205,6 +206,7 @@ class RegexURLResolver(object):
|
|||||||
try:
|
try:
|
||||||
lookup_view = getattr(__import__(mod_name, {}, {}, ['']), func_name)
|
lookup_view = getattr(__import__(mod_name, {}, {}, ['']), func_name)
|
||||||
except (ImportError, AttributeError):
|
except (ImportError, AttributeError):
|
||||||
|
if func_name != '':
|
||||||
raise NoReverseMatch
|
raise NoReverseMatch
|
||||||
for pattern in self.urlconf_module.urlpatterns:
|
for pattern in self.urlconf_module.urlpatterns:
|
||||||
if isinstance(pattern, RegexURLResolver):
|
if isinstance(pattern, RegexURLResolver):
|
||||||
@ -212,7 +214,7 @@ class RegexURLResolver(object):
|
|||||||
return pattern.reverse_helper(lookup_view, *args, **kwargs)
|
return pattern.reverse_helper(lookup_view, *args, **kwargs)
|
||||||
except NoReverseMatch:
|
except NoReverseMatch:
|
||||||
continue
|
continue
|
||||||
elif pattern.callback == lookup_view:
|
elif pattern.callback == lookup_view or pattern.name == lookup_view:
|
||||||
try:
|
try:
|
||||||
return pattern.reverse_helper(*args, **kwargs)
|
return pattern.reverse_helper(*args, **kwargs)
|
||||||
except NoReverseMatch:
|
except NoReverseMatch:
|
||||||
|
@ -138,7 +138,7 @@ def get_drop_foreignkey_sql():
|
|||||||
def get_pk_default_value():
|
def get_pk_default_value():
|
||||||
return "DEFAULT"
|
return "DEFAULT"
|
||||||
|
|
||||||
def get_sql_flush(sql_styler, full_table_list):
|
def get_sql_flush(style, tables, sequences):
|
||||||
"""Return a list of SQL statements required to remove all data from
|
"""Return a list of SQL statements required to remove all data from
|
||||||
all tables in the database (without actually removing the tables
|
all tables in the database (without actually removing the tables
|
||||||
themselves) and put the database in an empty 'initial' state
|
themselves) and put the database in an empty 'initial' state
|
||||||
@ -147,9 +147,14 @@ def get_sql_flush(sql_styler, full_table_list):
|
|||||||
# TODO - SQL not actually tested against ADO MSSQL yet!
|
# TODO - SQL not actually tested against ADO MSSQL yet!
|
||||||
# TODO - autoincrement indices reset required? See other get_sql_flush() implementations
|
# TODO - autoincrement indices reset required? See other get_sql_flush() implementations
|
||||||
sql_list = ['%s %s;' % \
|
sql_list = ['%s %s;' % \
|
||||||
(sql_styler.SQL_KEYWORD('TRUNCATE'),
|
(style.SQL_KEYWORD('TRUNCATE'),
|
||||||
sql_styler.SQL_FIELD(quote_name(table))
|
style.SQL_FIELD(quote_name(table))
|
||||||
) for table in full_table_list]
|
) for table in tables]
|
||||||
|
|
||||||
|
def get_sql_sequence_reset(style, model_list):
|
||||||
|
"Returns a list of the SQL statements to reset sequences for the given models."
|
||||||
|
# No sequence reset required
|
||||||
|
return []
|
||||||
|
|
||||||
OPERATOR_MAPPING = {
|
OPERATOR_MAPPING = {
|
||||||
'exact': '= %s',
|
'exact': '= %s',
|
||||||
|
@ -40,5 +40,6 @@ get_deferrable_sql = complain
|
|||||||
get_fulltext_search_sql = complain
|
get_fulltext_search_sql = complain
|
||||||
get_drop_foreignkey_sql = complain
|
get_drop_foreignkey_sql = complain
|
||||||
get_sql_flush = complain
|
get_sql_flush = complain
|
||||||
|
get_sql_sequence_reset = complain
|
||||||
|
|
||||||
OPERATOR_MAPPING = {}
|
OPERATOR_MAPPING = {}
|
||||||
|
@ -215,6 +215,11 @@ def get_sql_flush(style, tables, sequences):
|
|||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
def get_sql_sequence_reset(style, model_list):
|
||||||
|
"Returns a list of the SQL statements to reset sequences for the given models."
|
||||||
|
# No sequence reset required
|
||||||
|
return []
|
||||||
|
|
||||||
OPERATOR_MAPPING = {
|
OPERATOR_MAPPING = {
|
||||||
'exact': '= %s',
|
'exact': '= %s',
|
||||||
'iexact': 'LIKE %s',
|
'iexact': 'LIKE %s',
|
||||||
|
@ -217,6 +217,11 @@ def get_sql_flush(style, tables, sequences):
|
|||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
def get_sql_sequence_reset(style, model_list):
|
||||||
|
"Returns a list of the SQL statements to reset sequences for the given models."
|
||||||
|
# No sequence reset required
|
||||||
|
return []
|
||||||
|
|
||||||
OPERATOR_MAPPING = {
|
OPERATOR_MAPPING = {
|
||||||
'exact': '= %s',
|
'exact': '= %s',
|
||||||
'iexact': 'LIKE %s',
|
'iexact': 'LIKE %s',
|
||||||
|
@ -134,6 +134,10 @@ def get_sql_flush(style, tables, sequences):
|
|||||||
style.SQL_FIELD(quote_name(table))
|
style.SQL_FIELD(quote_name(table))
|
||||||
) for table in tables]
|
) for table in tables]
|
||||||
|
|
||||||
|
def get_sql_sequence_reset(style, model_list):
|
||||||
|
"Returns a list of the SQL statements to reset sequences for the given models."
|
||||||
|
# No sequence reset required
|
||||||
|
return []
|
||||||
|
|
||||||
OPERATOR_MAPPING = {
|
OPERATOR_MAPPING = {
|
||||||
'exact': '= %s',
|
'exact': '= %s',
|
||||||
|
@ -213,6 +213,30 @@ def get_sql_flush(style, tables, sequences):
|
|||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
def get_sql_sequence_reset(style, model_list):
|
||||||
|
"Returns a list of the SQL statements to reset sequences for the given models."
|
||||||
|
from django.db import models
|
||||||
|
output = []
|
||||||
|
for model in model_list:
|
||||||
|
for f in model._meta.fields:
|
||||||
|
if isinstance(f, models.AutoField):
|
||||||
|
output.append("%s setval('%s', (%s max(%s) %s %s));" % \
|
||||||
|
(style.SQL_KEYWORD('SELECT'),
|
||||||
|
style.SQL_FIELD('%s_%s_seq' % (model._meta.db_table, f.column)),
|
||||||
|
style.SQL_KEYWORD('SELECT'),
|
||||||
|
style.SQL_FIELD(quote_name(f.column)),
|
||||||
|
style.SQL_KEYWORD('FROM'),
|
||||||
|
style.SQL_TABLE(quote_name(model._meta.db_table))))
|
||||||
|
break # Only one AutoField is allowed per model, so don't bother continuing.
|
||||||
|
for f in model._meta.many_to_many:
|
||||||
|
output.append("%s setval('%s', (%s max(%s) %s %s));" % \
|
||||||
|
(style.SQL_KEYWORD('SELECT'),
|
||||||
|
style.SQL_FIELD('%s_id_seq' % f.m2m_db_table()),
|
||||||
|
style.SQL_KEYWORD('SELECT'),
|
||||||
|
style.SQL_FIELD(quote_name('id')),
|
||||||
|
style.SQL_KEYWORD('FROM'),
|
||||||
|
style.SQL_TABLE(f.m2m_db_table())))
|
||||||
|
return output
|
||||||
|
|
||||||
# Register these custom typecasts, because Django expects dates/times to be
|
# Register these custom typecasts, because Django expects dates/times to be
|
||||||
# in Python's native (standard-library) datetime/time format, whereas psycopg
|
# in Python's native (standard-library) datetime/time format, whereas psycopg
|
||||||
|
@ -170,6 +170,31 @@ def get_sql_flush(style, tables, sequences):
|
|||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
def get_sql_sequence_reset(style, model_list):
|
||||||
|
"Returns a list of the SQL statements to reset sequences for the given models."
|
||||||
|
from django.db import models
|
||||||
|
output = []
|
||||||
|
for model in model_list:
|
||||||
|
for f in model._meta.fields:
|
||||||
|
if isinstance(f, models.AutoField):
|
||||||
|
output.append("%s setval('%s', (%s max(%s) %s %s));" % \
|
||||||
|
(style.SQL_KEYWORD('SELECT'),
|
||||||
|
style.SQL_FIELD('%s_%s_seq' % (model._meta.db_table, f.column)),
|
||||||
|
style.SQL_KEYWORD('SELECT'),
|
||||||
|
style.SQL_FIELD(quote_name(f.column)),
|
||||||
|
style.SQL_KEYWORD('FROM'),
|
||||||
|
style.SQL_TABLE(quote_name(model._meta.db_table))))
|
||||||
|
break # Only one AutoField is allowed per model, so don't bother continuing.
|
||||||
|
for f in model._meta.many_to_many:
|
||||||
|
output.append("%s setval('%s', (%s max(%s) %s %s));" % \
|
||||||
|
(style.SQL_KEYWORD('SELECT'),
|
||||||
|
style.SQL_FIELD('%s_id_seq' % f.m2m_db_table()),
|
||||||
|
style.SQL_KEYWORD('SELECT'),
|
||||||
|
style.SQL_FIELD(quote_name('id')),
|
||||||
|
style.SQL_KEYWORD('FROM'),
|
||||||
|
style.SQL_TABLE(f.m2m_db_table())))
|
||||||
|
return output
|
||||||
|
|
||||||
OPERATOR_MAPPING = {
|
OPERATOR_MAPPING = {
|
||||||
'exact': '= %s',
|
'exact': '= %s',
|
||||||
'iexact': 'ILIKE %s',
|
'iexact': 'ILIKE %s',
|
||||||
|
@ -170,6 +170,11 @@ def get_sql_flush(style, tables, sequences):
|
|||||||
# get_sql_flush() implementations). Just return SQL at this point
|
# get_sql_flush() implementations). Just return SQL at this point
|
||||||
return sql
|
return sql
|
||||||
|
|
||||||
|
def get_sql_sequence_reset(style, model_list):
|
||||||
|
"Returns a list of the SQL statements to reset sequences for the given models."
|
||||||
|
# No sequence reset required
|
||||||
|
return []
|
||||||
|
|
||||||
def _sqlite_date_trunc(lookup_type, dt):
|
def _sqlite_date_trunc(lookup_type, dt):
|
||||||
try:
|
try:
|
||||||
dt = util.typecast_timestamp(dt)
|
dt = util.typecast_timestamp(dt)
|
||||||
|
@ -22,7 +22,12 @@ class ModelBase(type):
|
|||||||
"Metaclass for all models"
|
"Metaclass for all models"
|
||||||
def __new__(cls, name, bases, attrs):
|
def __new__(cls, name, bases, attrs):
|
||||||
# If this isn't a subclass of Model, don't do anything special.
|
# If this isn't a subclass of Model, don't do anything special.
|
||||||
if name == 'Model' or not filter(lambda b: issubclass(b, Model), bases):
|
try:
|
||||||
|
if not filter(lambda b: issubclass(b, Model), bases):
|
||||||
|
return super(ModelBase, cls).__new__(cls, name, bases, attrs)
|
||||||
|
except NameError:
|
||||||
|
# 'Model' isn't defined yet, meaning we're looking at Django's own
|
||||||
|
# Model class, defined below.
|
||||||
return super(ModelBase, cls).__new__(cls, name, bases, attrs)
|
return super(ModelBase, cls).__new__(cls, name, bases, attrs)
|
||||||
|
|
||||||
# Create the class.
|
# Create the class.
|
||||||
|
@ -155,6 +155,9 @@ def parse_cookie(cookie):
|
|||||||
|
|
||||||
class HttpResponse(object):
|
class HttpResponse(object):
|
||||||
"A basic HTTP response, with content and dictionary-accessed headers"
|
"A basic HTTP response, with content and dictionary-accessed headers"
|
||||||
|
|
||||||
|
status_code = 200
|
||||||
|
|
||||||
def __init__(self, content='', mimetype=None):
|
def __init__(self, content='', mimetype=None):
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
self._charset = settings.DEFAULT_CHARSET
|
self._charset = settings.DEFAULT_CHARSET
|
||||||
@ -168,7 +171,6 @@ class HttpResponse(object):
|
|||||||
self._is_string = True
|
self._is_string = True
|
||||||
self.headers = {'Content-Type': mimetype}
|
self.headers = {'Content-Type': mimetype}
|
||||||
self.cookies = SimpleCookie()
|
self.cookies = SimpleCookie()
|
||||||
self.status_code = 200
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"Full HTTP message, including headers"
|
"Full HTTP message, including headers"
|
||||||
@ -254,47 +256,49 @@ class HttpResponse(object):
|
|||||||
return sum([len(chunk) for chunk in self._container])
|
return sum([len(chunk) for chunk in self._container])
|
||||||
|
|
||||||
class HttpResponseRedirect(HttpResponse):
|
class HttpResponseRedirect(HttpResponse):
|
||||||
|
status_code = 302
|
||||||
|
|
||||||
def __init__(self, redirect_to):
|
def __init__(self, redirect_to):
|
||||||
HttpResponse.__init__(self)
|
HttpResponse.__init__(self)
|
||||||
self['Location'] = quote(redirect_to, safe=RESERVED_CHARS)
|
self['Location'] = quote(redirect_to, safe=RESERVED_CHARS)
|
||||||
self.status_code = 302
|
|
||||||
|
|
||||||
class HttpResponsePermanentRedirect(HttpResponse):
|
class HttpResponsePermanentRedirect(HttpResponse):
|
||||||
|
status_code = 301
|
||||||
|
|
||||||
def __init__(self, redirect_to):
|
def __init__(self, redirect_to):
|
||||||
HttpResponse.__init__(self)
|
HttpResponse.__init__(self)
|
||||||
self['Location'] = quote(redirect_to, safe=RESERVED_CHARS)
|
self['Location'] = quote(redirect_to, safe=RESERVED_CHARS)
|
||||||
self.status_code = 301
|
|
||||||
|
|
||||||
class HttpResponseNotModified(HttpResponse):
|
class HttpResponseNotModified(HttpResponse):
|
||||||
def __init__(self):
|
status_code = 304
|
||||||
HttpResponse.__init__(self)
|
|
||||||
self.status_code = 304
|
class HttpResponseBadRequest(HttpResponse):
|
||||||
|
status_code = 400
|
||||||
|
|
||||||
class HttpResponseNotFound(HttpResponse):
|
class HttpResponseNotFound(HttpResponse):
|
||||||
def __init__(self, *args, **kwargs):
|
status_code = 404
|
||||||
HttpResponse.__init__(self, *args, **kwargs)
|
|
||||||
self.status_code = 404
|
|
||||||
|
|
||||||
class HttpResponseForbidden(HttpResponse):
|
class HttpResponseForbidden(HttpResponse):
|
||||||
def __init__(self, *args, **kwargs):
|
status_code = 403
|
||||||
HttpResponse.__init__(self, *args, **kwargs)
|
|
||||||
self.status_code = 403
|
|
||||||
|
|
||||||
class HttpResponseNotAllowed(HttpResponse):
|
class HttpResponseNotAllowed(HttpResponse):
|
||||||
|
status_code = 405
|
||||||
|
|
||||||
def __init__(self, permitted_methods):
|
def __init__(self, permitted_methods):
|
||||||
HttpResponse.__init__(self)
|
HttpResponse.__init__(self)
|
||||||
self['Allow'] = ', '.join(permitted_methods)
|
self['Allow'] = ', '.join(permitted_methods)
|
||||||
self.status_code = 405
|
|
||||||
|
|
||||||
class HttpResponseGone(HttpResponse):
|
class HttpResponseGone(HttpResponse):
|
||||||
|
status_code = 410
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
HttpResponse.__init__(self, *args, **kwargs)
|
HttpResponse.__init__(self, *args, **kwargs)
|
||||||
self.status_code = 410
|
|
||||||
|
|
||||||
class HttpResponseServerError(HttpResponse):
|
class HttpResponseServerError(HttpResponse):
|
||||||
|
status_code = 500
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
HttpResponse.__init__(self, *args, **kwargs)
|
HttpResponse.__init__(self, *args, **kwargs)
|
||||||
self.status_code = 500
|
|
||||||
|
|
||||||
def get_host(request):
|
def get_host(request):
|
||||||
"Gets the HTTP host from the environment or request headers."
|
"Gets the HTTP host from the environment or request headers."
|
||||||
|
@ -3,7 +3,8 @@ Field classes
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from django.utils.translation import gettext
|
from django.utils.translation import gettext
|
||||||
from util import ErrorList, ValidationError, smart_unicode
|
from django.utils.encoding import smart_unicode
|
||||||
|
from util import ErrorList, ValidationError
|
||||||
from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple
|
from widgets import TextInput, PasswordInput, HiddenInput, MultipleHiddenInput, CheckboxInput, Select, NullBooleanSelect, SelectMultiple
|
||||||
import datetime
|
import datetime
|
||||||
import re
|
import re
|
||||||
@ -38,15 +39,16 @@ class Field(object):
|
|||||||
def __init__(self, required=True, widget=None, label=None, initial=None, help_text=None):
|
def __init__(self, required=True, widget=None, label=None, initial=None, help_text=None):
|
||||||
# required -- Boolean that specifies whether the field is required.
|
# required -- Boolean that specifies whether the field is required.
|
||||||
# True by default.
|
# True by default.
|
||||||
# widget -- A Widget class, or instance of a Widget class, that should be
|
# widget -- A Widget class, or instance of a Widget class, that should
|
||||||
# used for this Field when displaying it. Each Field has a default
|
# be used for this Field when displaying it. Each Field has a
|
||||||
# Widget that it'll use if you don't specify this. In most cases,
|
# default Widget that it'll use if you don't specify this. In
|
||||||
# the default widget is TextInput.
|
# most cases, the default widget is TextInput.
|
||||||
# label -- A verbose name for this field, for use in displaying this field in
|
# label -- A verbose name for this field, for use in displaying this
|
||||||
# a form. By default, Django will use a "pretty" version of the form
|
# field in a form. By default, Django will use a "pretty"
|
||||||
# field name, if the Field is part of a Form.
|
# version of the form field name, if the Field is part of a
|
||||||
# initial -- A value to use in this Field's initial display. This value is
|
# Form.
|
||||||
# *not* used as a fallback if data isn't given.
|
# initial -- A value to use in this Field's initial display. This value
|
||||||
|
# is *not* used as a fallback if data isn't given.
|
||||||
# help_text -- An optional string to use as "help text" for this Field.
|
# help_text -- An optional string to use as "help text" for this Field.
|
||||||
if label is not None:
|
if label is not None:
|
||||||
label = smart_unicode(label)
|
label = smart_unicode(label)
|
||||||
|
@ -4,9 +4,10 @@ Form classes
|
|||||||
|
|
||||||
from django.utils.datastructures import SortedDict, MultiValueDict
|
from django.utils.datastructures import SortedDict, MultiValueDict
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
|
from django.utils.encoding import StrAndUnicode
|
||||||
from fields import Field
|
from fields import Field
|
||||||
from widgets import TextInput, Textarea, HiddenInput, MultipleHiddenInput
|
from widgets import TextInput, Textarea, HiddenInput, MultipleHiddenInput
|
||||||
from util import flatatt, StrAndUnicode, ErrorDict, ErrorList, ValidationError
|
from util import flatatt, ErrorDict, ErrorList, ValidationError
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
__all__ = ('BaseForm', 'Form')
|
__all__ = ('BaseForm', 'Form')
|
||||||
@ -245,9 +246,9 @@ class BoundField(StrAndUnicode):
|
|||||||
value = self.as_widget(self.field.widget)
|
value = self.as_widget(self.field.widget)
|
||||||
if not isinstance(value, basestring):
|
if not isinstance(value, basestring):
|
||||||
# Some Widget render() methods -- notably RadioSelect -- return a
|
# Some Widget render() methods -- notably RadioSelect -- return a
|
||||||
# "special" object rather than a string. Call the __str__() on that
|
# "special" object rather than a string. Call __unicode__() on that
|
||||||
# object to get its rendered value.
|
# object to get its rendered value.
|
||||||
value = value.__str__()
|
value = unicode(value)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def _errors(self):
|
def _errors(self):
|
||||||
|
@ -36,12 +36,13 @@ def save_instance(form, instance, commit=True):
|
|||||||
raise ValueError("The %s could not be changed because the data didn't validate." % opts.object_name)
|
raise ValueError("The %s could not be changed because the data didn't validate." % opts.object_name)
|
||||||
clean_data = form.clean_data
|
clean_data = form.clean_data
|
||||||
for f in opts.fields:
|
for f in opts.fields:
|
||||||
if not f.editable or isinstance(f, models.AutoField):
|
if not f.editable or isinstance(f, models.AutoField) or not f.name in clean_data:
|
||||||
continue
|
continue
|
||||||
setattr(instance, f.name, clean_data[f.name])
|
setattr(instance, f.name, clean_data[f.name])
|
||||||
if commit:
|
if commit:
|
||||||
instance.save()
|
instance.save()
|
||||||
for f in opts.many_to_many:
|
for f in opts.many_to_many:
|
||||||
|
if f.name in clean_data:
|
||||||
setattr(instance, f.attname, clean_data[f.name])
|
setattr(instance, f.attname, clean_data[f.name])
|
||||||
# GOTCHA: If many-to-many data is given and commit=False, the many-to-many
|
# GOTCHA: If many-to-many data is given and commit=False, the many-to-many
|
||||||
# data will be lost. This happens because a many-to-many options cannot be
|
# data will be lost. This happens because a many-to-many options cannot be
|
||||||
|
@ -1,30 +1,12 @@
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
|
from django.utils.functional import Promise, lazy
|
||||||
|
from django.utils.encoding import smart_unicode
|
||||||
|
|
||||||
# Converts a dictionary to a single string with key="value", XML-style with
|
# Converts a dictionary to a single string with key="value", XML-style with
|
||||||
# a leading space. Assumes keys do not need to be XML-escaped.
|
# a leading space. Assumes keys do not need to be XML-escaped.
|
||||||
flatatt = lambda attrs: u''.join([u' %s="%s"' % (k, escape(v)) for k, v in attrs.items()])
|
flatatt = lambda attrs: u''.join([u' %s="%s"' % (k, escape(v)) for k, v in attrs.items()])
|
||||||
|
|
||||||
def smart_unicode(s):
|
|
||||||
if not isinstance(s, basestring):
|
|
||||||
if hasattr(s, '__unicode__'):
|
|
||||||
s = unicode(s)
|
|
||||||
else:
|
|
||||||
s = unicode(str(s), settings.DEFAULT_CHARSET)
|
|
||||||
elif not isinstance(s, unicode):
|
|
||||||
s = unicode(s, settings.DEFAULT_CHARSET)
|
|
||||||
return s
|
|
||||||
|
|
||||||
class StrAndUnicode(object):
|
|
||||||
"""
|
|
||||||
A class whose __str__ returns its __unicode__ as a bytestring
|
|
||||||
according to settings.DEFAULT_CHARSET.
|
|
||||||
|
|
||||||
Useful as a mix-in.
|
|
||||||
"""
|
|
||||||
def __str__(self):
|
|
||||||
return self.__unicode__().encode(settings.DEFAULT_CHARSET)
|
|
||||||
|
|
||||||
class ErrorDict(dict):
|
class ErrorDict(dict):
|
||||||
"""
|
"""
|
||||||
A collection of errors that knows how to display itself in various formats.
|
A collection of errors that knows how to display itself in various formats.
|
||||||
|
@ -9,10 +9,11 @@ __all__ = (
|
|||||||
'MultiWidget', 'SplitDateTimeWidget',
|
'MultiWidget', 'SplitDateTimeWidget',
|
||||||
)
|
)
|
||||||
|
|
||||||
from util import flatatt, StrAndUnicode, smart_unicode
|
from util import flatatt
|
||||||
from django.utils.datastructures import MultiValueDict
|
from django.utils.datastructures import MultiValueDict
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.translation import gettext
|
from django.utils.translation import gettext
|
||||||
|
from django.utils.encoding import StrAndUnicode, smart_unicode
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -24,7 +25,10 @@ class Widget(object):
|
|||||||
is_hidden = False # Determines whether this corresponds to an <input type="hidden">.
|
is_hidden = False # Determines whether this corresponds to an <input type="hidden">.
|
||||||
|
|
||||||
def __init__(self, attrs=None):
|
def __init__(self, attrs=None):
|
||||||
self.attrs = attrs or {}
|
if attrs is not None:
|
||||||
|
self.attrs = attrs.copy()
|
||||||
|
else:
|
||||||
|
self.attrs = {}
|
||||||
|
|
||||||
def render(self, name, value, attrs=None):
|
def render(self, name, value, attrs=None):
|
||||||
"""
|
"""
|
||||||
|
@ -923,7 +923,8 @@ class FilePathField(SelectField):
|
|||||||
for root, dirs, files in os.walk(path):
|
for root, dirs, files in os.walk(path):
|
||||||
for f in files:
|
for f in files:
|
||||||
if match is None or match_re.search(f):
|
if match is None or match_re.search(f):
|
||||||
choices.append((os.path.join(root, f), f))
|
f = os.path.join(root, f)
|
||||||
|
choices.append((f, f.replace(path, "", 1)))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
for f in os.listdir(path):
|
for f in os.listdir(path):
|
||||||
|
@ -354,6 +354,23 @@ class WidthRatioNode(Node):
|
|||||||
return ''
|
return ''
|
||||||
return str(int(round(ratio)))
|
return str(int(round(ratio)))
|
||||||
|
|
||||||
|
class WithNode(Node):
|
||||||
|
def __init__(self, var, name, nodelist):
|
||||||
|
self.var = var
|
||||||
|
self.name = name
|
||||||
|
self.nodelist = nodelist
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "<WithNode>"
|
||||||
|
|
||||||
|
def render(self, context):
|
||||||
|
val = self.var.resolve(context)
|
||||||
|
context.push()
|
||||||
|
context[self.name] = val
|
||||||
|
output = self.nodelist.render(context)
|
||||||
|
context.pop()
|
||||||
|
return output
|
||||||
|
|
||||||
#@register.tag
|
#@register.tag
|
||||||
def comment(parser, token):
|
def comment(parser, token):
|
||||||
"""
|
"""
|
||||||
@ -835,7 +852,7 @@ regroup = register.tag(regroup)
|
|||||||
|
|
||||||
def spaceless(parser, token):
|
def spaceless(parser, token):
|
||||||
"""
|
"""
|
||||||
Normalize whitespace between HTML tags to a single space. This includes tab
|
Removes whitespace between HTML tags. This includes tab
|
||||||
characters and newlines.
|
characters and newlines.
|
||||||
|
|
||||||
Example usage::
|
Example usage::
|
||||||
@ -967,3 +984,25 @@ def widthratio(parser, token):
|
|||||||
return WidthRatioNode(parser.compile_filter(this_value_expr),
|
return WidthRatioNode(parser.compile_filter(this_value_expr),
|
||||||
parser.compile_filter(max_value_expr), max_width)
|
parser.compile_filter(max_value_expr), max_width)
|
||||||
widthratio = register.tag(widthratio)
|
widthratio = register.tag(widthratio)
|
||||||
|
|
||||||
|
#@register.tag
|
||||||
|
def do_with(parser, token):
|
||||||
|
"""
|
||||||
|
Add a value to the context (inside of this block) for caching and easy
|
||||||
|
access.
|
||||||
|
|
||||||
|
For example::
|
||||||
|
|
||||||
|
{% with person.some_sql_method as total %}
|
||||||
|
{{ total }} object{{ total|pluralize }}
|
||||||
|
{% endwith %}
|
||||||
|
"""
|
||||||
|
bits = list(token.split_contents())
|
||||||
|
if len(bits) != 4 or bits[2] != "as":
|
||||||
|
raise TemplateSyntaxError, "%r expected format is 'value as name'" % tagname
|
||||||
|
var = parser.compile_filter(bits[1])
|
||||||
|
name = bits[3]
|
||||||
|
nodelist = parser.parse(('endwith',))
|
||||||
|
parser.delete_first_token()
|
||||||
|
return WithNode(var, name, nodelist)
|
||||||
|
do_with = register.tag('with', do_with)
|
||||||
|
@ -84,5 +84,5 @@ def run_tests(module_list, verbosity=1, extra_tests=[]):
|
|||||||
|
|
||||||
teardown_test_environment()
|
teardown_test_environment()
|
||||||
|
|
||||||
return len(result.failures)
|
return len(result.failures) + len(result.errors)
|
||||||
|
|
32
django/utils/encoding.py
Normal file
32
django/utils/encoding.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
from django.conf import settings
|
||||||
|
from django.utils.functional import Promise
|
||||||
|
|
||||||
|
def smart_unicode(s):
|
||||||
|
if isinstance(s, Promise):
|
||||||
|
# The input is the result of a gettext_lazy() call, or similar. It will
|
||||||
|
# already be encoded in DEFAULT_CHARSET on evaluation and we don't want
|
||||||
|
# to evaluate it until render time.
|
||||||
|
# FIXME: This isn't totally consistent, because it eventually returns a
|
||||||
|
# bytestring rather than a unicode object. It works wherever we use
|
||||||
|
# smart_unicode() at the moment. Fixing this requires work in the
|
||||||
|
# i18n internals.
|
||||||
|
return s
|
||||||
|
if not isinstance(s, basestring,):
|
||||||
|
if hasattr(s, '__unicode__'):
|
||||||
|
s = unicode(s)
|
||||||
|
else:
|
||||||
|
s = unicode(str(s), settings.DEFAULT_CHARSET)
|
||||||
|
elif not isinstance(s, unicode):
|
||||||
|
s = unicode(s, settings.DEFAULT_CHARSET)
|
||||||
|
return s
|
||||||
|
|
||||||
|
class StrAndUnicode(object):
|
||||||
|
"""
|
||||||
|
A class whose __str__ returns its __unicode__ as a bytestring
|
||||||
|
according to settings.DEFAULT_CHARSET.
|
||||||
|
|
||||||
|
Useful as a mix-in.
|
||||||
|
"""
|
||||||
|
def __str__(self):
|
||||||
|
return self.__unicode__().encode(settings.DEFAULT_CHARSET)
|
||||||
|
|
@ -1,6 +1,7 @@
|
|||||||
"HTML utilities suitable for global use."
|
"HTML utilities suitable for global use."
|
||||||
|
|
||||||
import re, string
|
import re, string
|
||||||
|
from django.utils.encoding import smart_unicode
|
||||||
|
|
||||||
# Configuration for urlize() function
|
# Configuration for urlize() function
|
||||||
LEADING_PUNCTUATION = ['(', '<', '<']
|
LEADING_PUNCTUATION = ['(', '<', '<']
|
||||||
@ -39,7 +40,7 @@ def strip_tags(value):
|
|||||||
return re.sub(r'<[^>]*?>', '', value)
|
return re.sub(r'<[^>]*?>', '', value)
|
||||||
|
|
||||||
def strip_spaces_between_tags(value):
|
def strip_spaces_between_tags(value):
|
||||||
"Returns the given HTML with spaces between tags normalized to a single space"
|
"Returns the given HTML with spaces between tags removed"
|
||||||
return re.sub(r'>\s+<', '><', value)
|
return re.sub(r'>\s+<', '><', value)
|
||||||
|
|
||||||
def strip_entities(value):
|
def strip_entities(value):
|
||||||
|
@ -191,14 +191,15 @@ def smart_split(text):
|
|||||||
Supports both single and double quotes, and supports escaping quotes with
|
Supports both single and double quotes, and supports escaping quotes with
|
||||||
backslashes. In the output, strings will keep their initial and trailing
|
backslashes. In the output, strings will keep their initial and trailing
|
||||||
quote marks.
|
quote marks.
|
||||||
|
|
||||||
>>> list(smart_split('This is "a person\'s" test.'))
|
>>> list(smart_split('This is "a person\'s" test.'))
|
||||||
['This', 'is', '"a person\'s"', 'test.']
|
['This', 'is', '"a person\'s"', 'test.']
|
||||||
"""
|
"""
|
||||||
for bit in smart_split_re.finditer(text):
|
for bit in smart_split_re.finditer(text):
|
||||||
bit = bit.group(0)
|
bit = bit.group(0)
|
||||||
if bit[0] == '"':
|
if bit[0] == '"' and bit[-1] == '"':
|
||||||
yield '"' + bit[1:-1].replace('\\"', '"').replace('\\\\', '\\') + '"'
|
yield '"' + bit[1:-1].replace('\\"', '"').replace('\\\\', '\\') + '"'
|
||||||
elif bit[0] == "'":
|
elif bit[0] == "'" and bit[-1] == "'":
|
||||||
yield "'" + bit[1:-1].replace("\\'", "'").replace("\\\\", "\\") + "'"
|
yield "'" + bit[1:-1].replace("\\'", "'").replace("\\\\", "\\") + "'"
|
||||||
else:
|
else:
|
||||||
yield bit
|
yield bit
|
||||||
|
@ -1,8 +1,97 @@
|
|||||||
|
"""
|
||||||
|
Internationalization support.
|
||||||
|
"""
|
||||||
|
from django.utils.functional import lazy
|
||||||
|
|
||||||
|
__all__ = ['gettext', 'gettext_noop', 'gettext_lazy', 'ngettext',
|
||||||
|
'ngettext_lazy', 'string_concat', 'activate', 'deactivate',
|
||||||
|
'get_language', 'get_language_bidi', 'get_date_formats',
|
||||||
|
'get_partial_date_formats', 'check_for_language', 'to_locale',
|
||||||
|
'get_language_from_request', 'install', 'templatize']
|
||||||
|
|
||||||
|
# Here be dragons, so a short explanation of the logic won't hurt:
|
||||||
|
# We are trying to solve two problems: (1) access settings, in particular
|
||||||
|
# settings.USE_I18N, as late as possible, so that modules can be imported
|
||||||
|
# without having to first configure Django, and (2) if some other code creates
|
||||||
|
# a reference to one of these functions, don't break that reference when we
|
||||||
|
# replace the functions with their real counterparts (once we do access the
|
||||||
|
# settings).
|
||||||
|
|
||||||
|
def delayed_loader(*args, **kwargs):
|
||||||
|
"""
|
||||||
|
Replace each real_* function with the corresponding function from either
|
||||||
|
trans_real or trans_null (e.g. real_gettext is replaced with
|
||||||
|
trans_real.gettext or trans_null.gettext). This function is run once, the
|
||||||
|
first time any i18n method is called. It replaces all the i18n methods at
|
||||||
|
once at that time.
|
||||||
|
"""
|
||||||
|
import traceback
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
if settings.USE_I18N:
|
if settings.USE_I18N:
|
||||||
from trans_real import *
|
import trans_real as trans
|
||||||
else:
|
else:
|
||||||
from trans_null import *
|
import trans_null as trans
|
||||||
|
caller = traceback.extract_stack(limit=2)[0][2]
|
||||||
|
g = globals()
|
||||||
|
for name in __all__:
|
||||||
|
if hasattr(trans, name):
|
||||||
|
g['real_%s' % name] = getattr(trans, name)
|
||||||
|
|
||||||
|
# Make the originally requested function call on the way out the door.
|
||||||
|
return g[caller](*args, **kwargs)
|
||||||
|
|
||||||
|
g = globals()
|
||||||
|
for name in __all__:
|
||||||
|
g['real_%s' % name] = delayed_loader
|
||||||
|
del g, delayed_loader
|
||||||
|
|
||||||
|
def gettext_noop(message):
|
||||||
|
return real_gettext_noop(message)
|
||||||
|
|
||||||
|
def gettext(message):
|
||||||
|
return real_gettext(message)
|
||||||
|
|
||||||
|
|
||||||
|
def ngettext(singular, plural, number):
|
||||||
|
return real_ngettext(singular, plural, number)
|
||||||
|
|
||||||
|
def string_concat(*strings):
|
||||||
|
return real_string_concat(*strings)
|
||||||
|
|
||||||
|
ngettext_lazy = lazy(ngettext, str, unicode)
|
||||||
|
gettext_lazy = lazy(gettext, str, unicode)
|
||||||
|
string_concat = lazy(string_concat, str, unicode)
|
||||||
|
|
||||||
|
def activate(language):
|
||||||
|
return real_activate(language)
|
||||||
|
|
||||||
|
def deactivate():
|
||||||
|
return real_deactivate()
|
||||||
|
|
||||||
|
def get_language():
|
||||||
|
return real_get_language()
|
||||||
|
|
||||||
|
def get_language_bidi():
|
||||||
|
return real_get_language_bidi()
|
||||||
|
|
||||||
|
def get_date_formats():
|
||||||
|
return real_get_date_formats()
|
||||||
|
|
||||||
|
def get_partial_date_formats():
|
||||||
|
return real_get_partial_date_formats()
|
||||||
|
|
||||||
|
def check_for_language(lang_code):
|
||||||
|
return real_check_for_language(lang_code)
|
||||||
|
|
||||||
|
def to_locale(language):
|
||||||
|
return real_to_locale(language)
|
||||||
|
|
||||||
|
def get_language_from_request(request):
|
||||||
|
return real_get_language_from_request(request)
|
||||||
|
|
||||||
|
def install():
|
||||||
|
return real_install()
|
||||||
|
|
||||||
|
def templatize(src):
|
||||||
|
return real_templatize(src)
|
||||||
|
|
||||||
del settings
|
|
||||||
|
@ -9,7 +9,6 @@ def ngettext(singular, plural, number):
|
|||||||
return plural
|
return plural
|
||||||
ngettext_lazy = ngettext
|
ngettext_lazy = ngettext
|
||||||
|
|
||||||
gettext = gettext_noop = gettext_lazy = _ = lambda x: x
|
|
||||||
string_concat = lambda *strings: ''.join([str(el) for el in strings])
|
string_concat = lambda *strings: ''.join([str(el) for el in strings])
|
||||||
activate = lambda x: None
|
activate = lambda x: None
|
||||||
deactivate = install = lambda: None
|
deactivate = install = lambda: None
|
||||||
@ -19,6 +18,20 @@ get_date_formats = lambda: (settings.DATE_FORMAT, settings.DATETIME_FORMAT, sett
|
|||||||
get_partial_date_formats = lambda: (settings.YEAR_MONTH_FORMAT, settings.MONTH_DAY_FORMAT)
|
get_partial_date_formats = lambda: (settings.YEAR_MONTH_FORMAT, settings.MONTH_DAY_FORMAT)
|
||||||
check_for_language = lambda x: True
|
check_for_language = lambda x: True
|
||||||
|
|
||||||
|
TECHNICAL_ID_MAP = {
|
||||||
|
"DATE_WITH_TIME_FULL": settings.DATETIME_FORMAT,
|
||||||
|
"DATE_FORMAT": settings.DATE_FORMAT,
|
||||||
|
"DATETIME_FORMAT": settings.DATETIME_FORMAT,
|
||||||
|
"TIME_FORMAT": settings.TIME_FORMAT,
|
||||||
|
"YEAR_MONTH_FORMAT": settings.YEAR_MONTH_FORMAT,
|
||||||
|
"MONTH_DAY_FORMAT": settings.MONTH_DAY_FORMAT,
|
||||||
|
}
|
||||||
|
|
||||||
|
def gettext(message):
|
||||||
|
return TECHNICAL_ID_MAP.get(message, message)
|
||||||
|
|
||||||
|
gettext_noop = gettext_lazy = _ = gettext
|
||||||
|
|
||||||
def to_locale(language):
|
def to_locale(language):
|
||||||
p = language.find('-')
|
p = language.find('-')
|
||||||
if p >= 0:
|
if p >= 0:
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
import os, re, sys
|
import os, re, sys
|
||||||
import gettext as gettext_module
|
import gettext as gettext_module
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
from django.utils.functional import lazy
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import threading
|
import threading
|
||||||
@ -277,9 +276,6 @@ def ngettext(singular, plural, number):
|
|||||||
_default = translation(settings.LANGUAGE_CODE)
|
_default = translation(settings.LANGUAGE_CODE)
|
||||||
return _default.ngettext(singular, plural, number)
|
return _default.ngettext(singular, plural, number)
|
||||||
|
|
||||||
gettext_lazy = lazy(gettext, str)
|
|
||||||
ngettext_lazy = lazy(ngettext, str)
|
|
||||||
|
|
||||||
def check_for_language(lang_code):
|
def check_for_language(lang_code):
|
||||||
"""
|
"""
|
||||||
Checks whether there is a global language file for the given language code.
|
Checks whether there is a global language file for the given language code.
|
||||||
@ -493,4 +489,3 @@ def string_concat(*strings):
|
|||||||
"""
|
"""
|
||||||
return ''.join([str(el) for el in strings])
|
return ''.join([str(el) for el in strings])
|
||||||
|
|
||||||
string_concat = lazy(string_concat, str)
|
|
||||||
|
@ -9,6 +9,13 @@ problems.
|
|||||||
This code lives in ``django/contrib`` in the Django distribution. Here's a
|
This code lives in ``django/contrib`` in the Django distribution. Here's a
|
||||||
rundown of the packages in ``contrib``:
|
rundown of the packages in ``contrib``:
|
||||||
|
|
||||||
|
.. admonition:: Note
|
||||||
|
|
||||||
|
For most of these add-ons -- specifically, the add-ons that include either
|
||||||
|
models or template tags -- you'll need to add the package name (e.g.,
|
||||||
|
``'django.contrib.admin'``) to your ``INSTALLED_APPS`` setting and re-run
|
||||||
|
``manage.py syncdb``.
|
||||||
|
|
||||||
.. _"batteries included" philosophy: http://docs.python.org/tut/node12.html#batteries-included
|
.. _"batteries included" philosophy: http://docs.python.org/tut/node12.html#batteries-included
|
||||||
|
|
||||||
admin
|
admin
|
||||||
@ -147,13 +154,20 @@ contains a ``USZipCodeField`` that you can use to validate U.S. zip codes.
|
|||||||
markup
|
markup
|
||||||
======
|
======
|
||||||
|
|
||||||
A collection of template filters that implement these common markup languages:
|
A collection of template filters that implement common markup languages:
|
||||||
|
|
||||||
* `Textile`_
|
* ``textile`` -- implements `Textile`_
|
||||||
* `Markdown`_
|
* ``markdown`` -- implements `Markdown`_
|
||||||
* `ReST (ReStructured Text)`_
|
* ``restructuredtext`` -- implements `ReST (ReStructured Text)`_
|
||||||
|
|
||||||
For documentation, read the source code in django/contrib/markup/templatetags/markup.py.
|
In each case, the filter expects formatted markup as a string and returns a
|
||||||
|
string representing the marked-up text. For example, the ``textile`` filter
|
||||||
|
converts text that is marked-up in Textile format to HTML.
|
||||||
|
|
||||||
|
To activate these filters, add ``'django.contrib.markup'`` to your
|
||||||
|
``INSTALLED_APPS`` setting. Once you've done that, use ``{% load markup %}`` in
|
||||||
|
a template, and you'll have access to these filters. For more documentation,
|
||||||
|
read the source code in django/contrib/markup/templatetags/markup.py.
|
||||||
|
|
||||||
.. _Textile: http://en.wikipedia.org/wiki/Textile_%28markup_language%29
|
.. _Textile: http://en.wikipedia.org/wiki/Textile_%28markup_language%29
|
||||||
.. _Markdown: http://en.wikipedia.org/wiki/Markdown
|
.. _Markdown: http://en.wikipedia.org/wiki/Markdown
|
||||||
|
@ -66,10 +66,19 @@ deleting arbitrary data in the cache. All data is stored directly in memory,
|
|||||||
so there's no overhead of database or filesystem usage.
|
so there's no overhead of database or filesystem usage.
|
||||||
|
|
||||||
After installing Memcached itself, you'll need to install the Memcached Python
|
After installing Memcached itself, you'll need to install the Memcached Python
|
||||||
bindings. They're in a single Python module, memcache.py, available at
|
bindings. Two versions of this are available. Choose and install *one* of the
|
||||||
ftp://ftp.tummy.com/pub/python-memcached/ . If that URL is no longer valid,
|
following modules:
|
||||||
just go to the Memcached Web site (http://www.danga.com/memcached/) and get the
|
|
||||||
Python bindings from the "Client APIs" section.
|
* The fastest available option is a module called ``cmemcache``, available
|
||||||
|
at http://gijsbert.org/cmemcache/ . (This module is only compatible with
|
||||||
|
the Django development version. Django 0.96 is only compatible with the
|
||||||
|
second option, below.)
|
||||||
|
|
||||||
|
* If you can't install ``cmemcache``, you can install ``python-memcached``,
|
||||||
|
available at ftp://ftp.tummy.com/pub/python-memcached/ . If that URL is
|
||||||
|
no longer valid, just go to the Memcached Web site
|
||||||
|
(http://www.danga.com/memcached/) and get the Python bindings from the
|
||||||
|
"Client APIs" section.
|
||||||
|
|
||||||
To use Memcached with Django, set ``CACHE_BACKEND`` to
|
To use Memcached with Django, set ``CACHE_BACKEND`` to
|
||||||
``memcached://ip:port/``, where ``ip`` is the IP address of the Memcached
|
``memcached://ip:port/``, where ``ip`` is the IP address of the Memcached
|
||||||
|
@ -366,7 +366,7 @@ Prints the DROP TABLE SQL, then the CREATE TABLE SQL, for the given appnames.
|
|||||||
sqlsequencereset [appname appname ...]
|
sqlsequencereset [appname appname ...]
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
|
|
||||||
Prints the SQL statements for resetting PostgreSQL sequences for the given
|
Prints the SQL statements for resetting sequences for the given
|
||||||
appnames.
|
appnames.
|
||||||
|
|
||||||
See http://simon.incutio.com/archive/2004/04/21/postgres for more information.
|
See http://simon.incutio.com/archive/2004/04/21/postgres for more information.
|
||||||
|
11
docs/faq.txt
11
docs/faq.txt
@ -328,8 +328,9 @@ Do I have to use mod_python?
|
|||||||
|
|
||||||
Although we recommend mod_python for production use, you don't have to use it,
|
Although we recommend mod_python for production use, you don't have to use it,
|
||||||
thanks to the fact that Django uses an arrangement called WSGI_. Django can
|
thanks to the fact that Django uses an arrangement called WSGI_. Django can
|
||||||
talk to any WSGI-enabled server. The most common non-mod_python deployment
|
talk to any WSGI-enabled server. Other non-mod_python deployment setups are
|
||||||
setup is FastCGI. See `How to use Django with FastCGI`_ for full information.
|
FastCGI, SCGI or AJP. See `How to use Django with FastCGI, SCGI or AJP`_ for
|
||||||
|
full information.
|
||||||
|
|
||||||
Also, see the `server arrangements wiki page`_ for other deployment strategies.
|
Also, see the `server arrangements wiki page`_ for other deployment strategies.
|
||||||
|
|
||||||
@ -337,7 +338,7 @@ If you just want to play around and develop things on your local computer, use
|
|||||||
the development Web server that comes with Django. Things should Just Work.
|
the development Web server that comes with Django. Things should Just Work.
|
||||||
|
|
||||||
.. _WSGI: http://www.python.org/peps/pep-0333.html
|
.. _WSGI: http://www.python.org/peps/pep-0333.html
|
||||||
.. _How to use Django with FastCGI: ../fastcgi/
|
.. _How to use Django with FastCGI, SCGI or AJP: ../fastcgi/
|
||||||
.. _server arrangements wiki page: http://code.djangoproject.com/wiki/ServerArrangements
|
.. _server arrangements wiki page: http://code.djangoproject.com/wiki/ServerArrangements
|
||||||
|
|
||||||
How do I install mod_python on Windows?
|
How do I install mod_python on Windows?
|
||||||
@ -381,9 +382,9 @@ Why do I get an error about importing DJANGO_SETTINGS_MODULE?
|
|||||||
Make sure that:
|
Make sure that:
|
||||||
|
|
||||||
* The environment variable DJANGO_SETTINGS_MODULE is set to a fully-qualified
|
* The environment variable DJANGO_SETTINGS_MODULE is set to a fully-qualified
|
||||||
Python module (i.e. "mysite.settings.main").
|
Python module (i.e. "mysite.settings").
|
||||||
|
|
||||||
* Said module is on ``sys.path`` (``import mysite.settings.main`` should work).
|
* Said module is on ``sys.path`` (``import mysite.settings`` should work).
|
||||||
|
|
||||||
* The module doesn't contain syntax errors (of course).
|
* The module doesn't contain syntax errors (of course).
|
||||||
|
|
||||||
|
@ -1,11 +1,17 @@
|
|||||||
==============================
|
===========================================
|
||||||
How to use Django with FastCGI
|
How to use Django with FastCGI, SCGI or AJP
|
||||||
==============================
|
===========================================
|
||||||
|
|
||||||
Although the `current preferred setup`_ for running Django is Apache_ with
|
Although the `current preferred setup`_ for running Django is Apache_ with
|
||||||
`mod_python`_, many people use shared hosting, on which FastCGI is the only
|
`mod_python`_, many people use shared hosting, on which protocols such as
|
||||||
viable option. In some setups, FastCGI also allows better security -- and,
|
FastCGI, SCGI or AJP are the only viable options. In some setups, these protocols
|
||||||
possibly, better performance -- than mod_python.
|
also allow better security -- and, possibly, better performance -- than mod_python.
|
||||||
|
|
||||||
|
.. admonition:: Note
|
||||||
|
|
||||||
|
This document primarily focuses on FastCGI. Other protocols, such as SCGI
|
||||||
|
and AJP, are also supported, through the ``flup`` Python package. See the
|
||||||
|
"Protocols" section below for specifics about SCGI and AJP.
|
||||||
|
|
||||||
Essentially, FastCGI is an efficient way of letting an external application
|
Essentially, FastCGI is an efficient way of letting an external application
|
||||||
serve pages to a Web server. The Web server delegates the incoming Web requests
|
serve pages to a Web server. The Web server delegates the incoming Web requests
|
||||||
@ -74,10 +80,26 @@ your ``manage.py`` is), and then run ``manage.py`` with the ``runfcgi`` option::
|
|||||||
If you specify ``help`` as the only option after ``runfcgi``, it'll display a
|
If you specify ``help`` as the only option after ``runfcgi``, it'll display a
|
||||||
list of all the available options.
|
list of all the available options.
|
||||||
|
|
||||||
You'll need to specify either a ``socket`` or both ``host`` and ``port``. Then,
|
You'll need to specify either a ``socket``, ``protocol`` or both ``host`` and ``port``.
|
||||||
when you set up your Web server, you'll just need to point it at the host/port
|
Then, when you set up your Web server, you'll just need to point it at the host/port
|
||||||
or socket you specified when starting the FastCGI server.
|
or socket you specified when starting the FastCGI server.
|
||||||
|
|
||||||
|
Protocols
|
||||||
|
---------
|
||||||
|
|
||||||
|
Django supports all the protocols that flup_ does, namely fastcgi_, `SCGI`_ and
|
||||||
|
`AJP1.3`_ (the Apache JServ Protocol, version 1.3). Select your preferred
|
||||||
|
protocol by using the ``protocol=<protocol_name>`` option with
|
||||||
|
``./manage.py runfcgi`` -- where ``<protocol_name>`` may be one of: ``fcgi``
|
||||||
|
(the default), ``scgi`` or ``ajp``. For example::
|
||||||
|
|
||||||
|
./manage.py runfcgi --protocol=scgi
|
||||||
|
|
||||||
|
.. _flup: http://www.saddi.com/software/flup/
|
||||||
|
.. _fastcgi: http://www.fastcgi.com/
|
||||||
|
.. _SCGI: http://python.ca/scgi/protocol.txt
|
||||||
|
.. _AJP1.3: http://tomcat.apache.org/connectors-doc/ajp/ajpv13a.html
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
@ -517,10 +517,10 @@ to put punctuation at the end of your validation messages.
|
|||||||
When are validators called?
|
When are validators called?
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
After a form has been submitted, Django first checks to see that all the
|
After a form has been submitted, Django validates each field in turn. First,
|
||||||
required fields are present and non-empty. For each field that passes that
|
if the field is required, Django checks that it is present and non-empty. Then,
|
||||||
test *and if the form submission contained data* for that field, all the
|
if that test passes *and the form submission contained data* for that field, all
|
||||||
validators for that field are called in turn. The emphasized portion in the
|
the validators for that field are called in turn. The emphasized portion in the
|
||||||
last sentence is important: if a form field is not submitted (because it
|
last sentence is important: if a form field is not submitted (because it
|
||||||
contains no data -- which is normal HTML behavior), the validators are not
|
contains no data -- which is normal HTML behavior), the validators are not
|
||||||
run against the field.
|
run against the field.
|
||||||
|
@ -222,7 +222,7 @@ In addition to ``extra_context``, the template's context will be:
|
|||||||
by ``date_field``. For example, if ``num_latest`` is ``10``, then
|
by ``date_field``. For example, if ``num_latest`` is ``10``, then
|
||||||
``latest`` will be a list of the latest 10 objects in ``queryset``.
|
``latest`` will be a list of the latest 10 objects in ``queryset``.
|
||||||
|
|
||||||
.. _RequestContext docs: ../templates_python/#subclassing-context-djangocontext
|
.. _RequestContext docs: ../templates_python/#subclassing-context-requestcontext
|
||||||
|
|
||||||
``django.views.generic.date_based.archive_year``
|
``django.views.generic.date_based.archive_year``
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
|
@ -1758,16 +1758,38 @@ slightly violates the DRY principle: the URL for this object is defined both
|
|||||||
in the URLConf file and in the model.
|
in the URLConf file and in the model.
|
||||||
|
|
||||||
You can further decouple your models from the URLconf using the ``permalink``
|
You can further decouple your models from the URLconf using the ``permalink``
|
||||||
decorator. This decorator is passed the view function and any parameters you
|
decorator. This decorator is passed the view function, a list of positional
|
||||||
would use for accessing this instance directly. Django then works out the
|
parameters and (optionally) a dictionary of named parameters. Django then
|
||||||
correct full URL path using the URLconf. For example::
|
works out the correct full URL path using the URLconf, substituting the
|
||||||
|
parameters you have given into the URL. For example, if your URLconf
|
||||||
|
contained a line such as::
|
||||||
|
|
||||||
|
(r'^/people/(\d+)/$', 'people.views.details'),
|
||||||
|
|
||||||
|
...your model could have a ``get_absolute_url`` method that looked like this::
|
||||||
|
|
||||||
from django.db.models import permalink
|
from django.db.models import permalink
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return ('people.views.details', str(self.id))
|
return ('people.views.details', [str(self.id)])
|
||||||
get_absolute_url = permalink(get_absolute_url)
|
get_absolute_url = permalink(get_absolute_url)
|
||||||
|
|
||||||
|
Similarly, if you had a URLconf entry that looked like::
|
||||||
|
|
||||||
|
(r'/archive/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/$', archive_view)
|
||||||
|
|
||||||
|
...you could reference this using ``permalink()`` as follows::
|
||||||
|
|
||||||
|
def get_absolute_url(self):
|
||||||
|
return ('archive_view', (), {
|
||||||
|
'year': self.created.year,
|
||||||
|
'month': self.created.month,
|
||||||
|
'day': self.created.day})
|
||||||
|
get_absolute_url = permalink(get_absolute_url)
|
||||||
|
|
||||||
|
Notice that we specify an empty sequence for the second argument in this case,
|
||||||
|
because we only want to pass keyword arguments, not named arguments.
|
||||||
|
|
||||||
In this way, you're tying the model's absolute URL to the view that is used
|
In this way, you're tying the model's absolute URL to the view that is used
|
||||||
to display it, without repeating the URL information anywhere. You can still
|
to display it, without repeating the URL information anywhere. You can still
|
||||||
use the ``get_absolute_url`` method in templates, as before.
|
use the ``get_absolute_url`` method in templates, as before.
|
||||||
|
@ -13,14 +13,15 @@ other server arrangements.
|
|||||||
Django requires Apache 2.x and mod_python 3.x, and you should use Apache's
|
Django requires Apache 2.x and mod_python 3.x, and you should use Apache's
|
||||||
`prefork MPM`_, as opposed to the `worker MPM`_.
|
`prefork MPM`_, as opposed to the `worker MPM`_.
|
||||||
|
|
||||||
You may also be interested in `How to use Django with FastCGI`_.
|
You may also be interested in `How to use Django with FastCGI, SCGI or AJP`_
|
||||||
|
(which also covers SCGI and AJP).
|
||||||
|
|
||||||
.. _Apache: http://httpd.apache.org/
|
.. _Apache: http://httpd.apache.org/
|
||||||
.. _mod_python: http://www.modpython.org/
|
.. _mod_python: http://www.modpython.org/
|
||||||
.. _mod_perl: http://perl.apache.org/
|
.. _mod_perl: http://perl.apache.org/
|
||||||
.. _prefork MPM: http://httpd.apache.org/docs/2.2/mod/prefork.html
|
.. _prefork MPM: http://httpd.apache.org/docs/2.2/mod/prefork.html
|
||||||
.. _worker MPM: http://httpd.apache.org/docs/2.2/mod/worker.html
|
.. _worker MPM: http://httpd.apache.org/docs/2.2/mod/worker.html
|
||||||
.. _How to use Django with FastCGI: ../fastcgi/
|
.. _How to use Django with FastCGI, SCGI or AJP: ../fastcgi/
|
||||||
|
|
||||||
Basic configuration
|
Basic configuration
|
||||||
===================
|
===================
|
||||||
@ -37,7 +38,8 @@ Then edit your ``httpd.conf`` file and add the following::
|
|||||||
PythonDebug On
|
PythonDebug On
|
||||||
</Location>
|
</Location>
|
||||||
|
|
||||||
...and replace ``mysite.settings`` with the Python path to your settings file.
|
...and replace ``mysite.settings`` with the Python import path to your Django
|
||||||
|
project's settings file.
|
||||||
|
|
||||||
This tells Apache: "Use mod_python for any URL at or under '/mysite/', using the
|
This tells Apache: "Use mod_python for any URL at or under '/mysite/', using the
|
||||||
Django mod_python handler." It passes the value of ``DJANGO_SETTINGS_MODULE``
|
Django mod_python handler." It passes the value of ``DJANGO_SETTINGS_MODULE``
|
||||||
@ -53,6 +55,19 @@ on it, you'll need to tell mod_python::
|
|||||||
|
|
||||||
PythonPath "['/path/to/project'] + sys.path"
|
PythonPath "['/path/to/project'] + sys.path"
|
||||||
|
|
||||||
|
.. caution::
|
||||||
|
|
||||||
|
Is you are using Windows, remember that the path will contain backslashes.
|
||||||
|
This string is passed through Python's string parser twice, so you need to
|
||||||
|
escape each backslash **twice**::
|
||||||
|
|
||||||
|
PythonPath "['c:\\\\path\\\\to\\\\project'] + sys.path"
|
||||||
|
|
||||||
|
or use raw strings::
|
||||||
|
|
||||||
|
PythonPath "[r'c:\\path\\to\\project'] + sys.path"
|
||||||
|
|
||||||
|
|
||||||
You can also add directives such as ``PythonAutoReload Off`` for performance.
|
You can also add directives such as ``PythonAutoReload Off`` for performance.
|
||||||
See the `mod_python documentation`_ for a full list of options.
|
See the `mod_python documentation`_ for a full list of options.
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ Database constraint names changed
|
|||||||
The format of the constraint names Django generates for foreign key
|
The format of the constraint names Django generates for foreign key
|
||||||
references have changed slightly. These names are generally only used
|
references have changed slightly. These names are generally only used
|
||||||
when it is not possible to put the reference directly on the affected
|
when it is not possible to put the reference directly on the affected
|
||||||
column, so they is not always visible.
|
column, so they are not always visible.
|
||||||
|
|
||||||
The effect of this change is that running ``manage.py reset`` and
|
The effect of this change is that running ``manage.py reset`` and
|
||||||
similar commands against an existing database may generate SQL with
|
similar commands against an existing database may generate SQL with
|
||||||
|
@ -416,6 +416,10 @@ types of HTTP responses. Like ``HttpResponse``, these subclasses live in
|
|||||||
The constructor doesn't take any arguments. Use this to designate that a
|
The constructor doesn't take any arguments. Use this to designate that a
|
||||||
page hasn't been modified since the user's last request.
|
page hasn't been modified since the user's last request.
|
||||||
|
|
||||||
|
``HttpResponseBadRequest``
|
||||||
|
**New in Django development version.**
|
||||||
|
Acts just like ``HttpResponse`` but uses a 400 status code.
|
||||||
|
|
||||||
``HttpResponseNotFound``
|
``HttpResponseNotFound``
|
||||||
Acts just like ``HttpResponse`` but uses a 404 status code.
|
Acts just like ``HttpResponse`` but uses a 404 status code.
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ is defined in ``django/contrib/sessions/models.py``. Because it's a normal
|
|||||||
model, you can access sessions using the normal Django database API::
|
model, you can access sessions using the normal Django database API::
|
||||||
|
|
||||||
>>> from django.contrib.sessions.models import Session
|
>>> from django.contrib.sessions.models import Session
|
||||||
>>> s = Session.objects.get_object(pk='2b1189a188b44ad18c35e113ac6ceead')
|
>>> s = Session.objects.get(pk='2b1189a188b44ad18c35e113ac6ceead')
|
||||||
>>> s.expire_date
|
>>> s.expire_date
|
||||||
datetime.datetime(2005, 8, 20, 13, 35, 12)
|
datetime.datetime(2005, 8, 20, 13, 35, 12)
|
||||||
|
|
||||||
|
@ -737,6 +737,7 @@ The following snippet of template code would accomplish this dubious task::
|
|||||||
<li>{{ item }}</li>
|
<li>{{ item }}</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@ -756,7 +757,7 @@ i.e.::
|
|||||||
spaceless
|
spaceless
|
||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
|
|
||||||
Normalizes whitespace between HTML tags to a single space. This includes tab
|
Removes whitespace between HTML tags. This includes tab
|
||||||
characters and newlines.
|
characters and newlines.
|
||||||
|
|
||||||
Example usage::
|
Example usage::
|
||||||
@ -771,7 +772,7 @@ This example would return this HTML::
|
|||||||
|
|
||||||
<p><a href="foo/">Foo</a></p>
|
<p><a href="foo/">Foo</a></p>
|
||||||
|
|
||||||
Only space between *tags* is normalized -- not space between tags and text. In
|
Only space between *tags* is removed -- not space between tags and text. In
|
||||||
this example, the space around ``Hello`` won't be stripped::
|
this example, the space around ``Hello`` won't be stripped::
|
||||||
|
|
||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
@ -872,6 +873,23 @@ Above, if ``this_value`` is 175 and ``max_value`` is 200, the the image in the
|
|||||||
above example will be 88 pixels wide (because 175/200 = .875; .875 * 100 = 87.5
|
above example will be 88 pixels wide (because 175/200 = .875; .875 * 100 = 87.5
|
||||||
which is rounded up to 88).
|
which is rounded up to 88).
|
||||||
|
|
||||||
|
with
|
||||||
|
~~~~
|
||||||
|
|
||||||
|
**New in Django development version**
|
||||||
|
|
||||||
|
Caches a complex variable under a simpler name. This is useful when accessing
|
||||||
|
an "expensive" method (e.g., one that hits the database) multiple times.
|
||||||
|
|
||||||
|
For example::
|
||||||
|
|
||||||
|
{% with business.employees.count as total %}
|
||||||
|
{{ total }} employee{{ total|pluralize }}
|
||||||
|
{% endwith %}
|
||||||
|
|
||||||
|
The populated variable (in the example above, ``total``) is only available
|
||||||
|
between the ``{% with %}`` and ``{% endwith %}`` tags.
|
||||||
|
|
||||||
Built-in filter reference
|
Built-in filter reference
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ for testing purposes:
|
|||||||
``status_code`` The HTTP status of the response. See RFC2616_ for a
|
``status_code`` The HTTP status of the response. See RFC2616_ for a
|
||||||
full list of HTTP status codes.
|
full list of HTTP status codes.
|
||||||
|
|
||||||
``content`` The body of the response. The is the final page
|
``content`` The body of the response. This is the final page
|
||||||
content as rendered by the view, or any error message
|
content as rendered by the view, or any error message
|
||||||
(such as the URL for a 302 redirect).
|
(such as the URL for a 302 redirect).
|
||||||
|
|
||||||
@ -468,7 +468,8 @@ failed::
|
|||||||
|
|
||||||
FAILED (failures=1)
|
FAILED (failures=1)
|
||||||
|
|
||||||
The return code for the script will indicate the number of tests that failed.
|
The return code for the script is the total number of failed and erroneous
|
||||||
|
tests. If all the tests pass, the return code is 0.
|
||||||
|
|
||||||
Regardless of whether the tests pass or fail, the test database is destroyed when
|
Regardless of whether the tests pass or fail, the test database is destroyed when
|
||||||
all the tests have been executed.
|
all the tests have been executed.
|
||||||
|
@ -133,8 +133,8 @@ Now, edit ``settings.py``. It's a normal Python module with module-level
|
|||||||
variables representing Django settings. Change these settings to match your
|
variables representing Django settings. Change these settings to match your
|
||||||
database's connection parameters:
|
database's connection parameters:
|
||||||
|
|
||||||
* ``DATABASE_ENGINE`` -- Either 'postgresql', 'mysql' or 'sqlite3'.
|
* ``DATABASE_ENGINE`` -- Either 'postgresql_psycopg2', 'mysql' or 'sqlite3'.
|
||||||
More coming soon.
|
Other backends are `also available`_.
|
||||||
* ``DATABASE_NAME`` -- The name of your database, or the full (absolute)
|
* ``DATABASE_NAME`` -- The name of your database, or the full (absolute)
|
||||||
path to the database file if you're using SQLite.
|
path to the database file if you're using SQLite.
|
||||||
* ``DATABASE_USER`` -- Your database username (not used for SQLite).
|
* ``DATABASE_USER`` -- Your database username (not used for SQLite).
|
||||||
@ -143,6 +143,8 @@ database's connection parameters:
|
|||||||
empty string if your database server is on the same physical machine
|
empty string if your database server is on the same physical machine
|
||||||
(not used for SQLite).
|
(not used for SQLite).
|
||||||
|
|
||||||
|
.. _also available: ../settings/
|
||||||
|
|
||||||
.. admonition:: Note
|
.. admonition:: Note
|
||||||
|
|
||||||
If you're using PostgreSQL or MySQL, make sure you've created a database by
|
If you're using PostgreSQL or MySQL, make sure you've created a database by
|
||||||
@ -319,7 +321,8 @@ Now Django knows ``mysite`` includes the ``polls`` app. Let's run another comman
|
|||||||
|
|
||||||
python manage.py sql polls
|
python manage.py sql polls
|
||||||
|
|
||||||
You should see the following (the CREATE TABLE SQL statements for the polls app)::
|
You should see something similar to the following (the CREATE TABLE SQL statements
|
||||||
|
for the polls app)::
|
||||||
|
|
||||||
BEGIN;
|
BEGIN;
|
||||||
CREATE TABLE "polls_poll" (
|
CREATE TABLE "polls_poll" (
|
||||||
@ -337,6 +340,8 @@ You should see the following (the CREATE TABLE SQL statements for the polls app)
|
|||||||
|
|
||||||
Note the following:
|
Note the following:
|
||||||
|
|
||||||
|
* The exact output will vary depending on the database you are using.
|
||||||
|
|
||||||
* Table names are automatically generated by combining the name of the app
|
* Table names are automatically generated by combining the name of the app
|
||||||
(``polls``) and the lowercase name of the model -- ``poll`` and
|
(``polls``) and the lowercase name of the model -- ``poll`` and
|
||||||
``choice``. (You can override this behavior.)
|
``choice``. (You can override this behavior.)
|
||||||
@ -365,8 +370,9 @@ If you're interested, also run the following commands:
|
|||||||
* ``python manage.py validate polls`` -- Checks for any errors in the
|
* ``python manage.py validate polls`` -- Checks for any errors in the
|
||||||
construction of your models.
|
construction of your models.
|
||||||
|
|
||||||
* ``python manage.py sqlinitialdata polls`` -- Outputs any initial data
|
* ``python manage.py sqlcustom polls`` -- Outputs any custom SQL statements
|
||||||
required for Django's admin framework and your models.
|
(such as table modifications or constraints) that are defined for the
|
||||||
|
application.
|
||||||
|
|
||||||
* ``python manage.py sqlclear polls`` -- Outputs the necessary ``DROP
|
* ``python manage.py sqlclear polls`` -- Outputs the necessary ``DROP
|
||||||
TABLE`` statements for this app, according to which tables already exist
|
TABLE`` statements for this app, according to which tables already exist
|
||||||
|
@ -185,10 +185,25 @@ The first argument to ``patterns()`` is a string ``prefix``. See
|
|||||||
|
|
||||||
The remaining arguments should be tuples in this format::
|
The remaining arguments should be tuples in this format::
|
||||||
|
|
||||||
(regular expression, Python callback function [, optional dictionary])
|
(regular expression, Python callback function [, optional dictionary [, optional name]])
|
||||||
|
|
||||||
...where ``optional dictionary`` is optional. (See
|
...where ``optional dictionary`` and ``optional name`` are optional. (See
|
||||||
_`Passing extra options to view functions` below.)
|
`Passing extra options to view functions`_ below.)
|
||||||
|
|
||||||
|
url
|
||||||
|
---
|
||||||
|
**New in development version**
|
||||||
|
|
||||||
|
The ``url()`` function can be used instead of a tuple as an argument to
|
||||||
|
``patterns()``. This is convenient if you wish to specify a name without the
|
||||||
|
optional extra arguments dictionary. For example::
|
||||||
|
|
||||||
|
urlpatterns = patterns('',
|
||||||
|
url(r'/index/$', index_view, name="main-view"),
|
||||||
|
...
|
||||||
|
)
|
||||||
|
|
||||||
|
See `Naming URL patterns`_ for why the ``name`` parameter is useful.
|
||||||
|
|
||||||
handler404
|
handler404
|
||||||
----------
|
----------
|
||||||
@ -479,3 +494,44 @@ The style you use is up to you.
|
|||||||
|
|
||||||
Note that if you use this technique -- passing objects rather than strings --
|
Note that if you use this technique -- passing objects rather than strings --
|
||||||
the view prefix (as explained in "The view prefix" above) will have no effect.
|
the view prefix (as explained in "The view prefix" above) will have no effect.
|
||||||
|
|
||||||
|
Naming URL patterns
|
||||||
|
===================
|
||||||
|
|
||||||
|
**New in development version**
|
||||||
|
|
||||||
|
It is fairly common to use the same view function in multiple URL patterns in
|
||||||
|
your URLConf. This leads to problems when you come to do reverse URL matching,
|
||||||
|
because the ``permalink()`` decorator and ``{% url %}`` template tag use the
|
||||||
|
name of the view function to find a match.
|
||||||
|
|
||||||
|
To solve this problem, you can give a name to each of your URL patterns in
|
||||||
|
order to distinguish them from other patterns using the same views and
|
||||||
|
parameters. You can then use this name wherever you would otherwise use the
|
||||||
|
name of the view function. For example, if you URLConf contains::
|
||||||
|
|
||||||
|
urlpatterns = patterns('',
|
||||||
|
url(r'/archive/(\d{4})/$', archive, name="full-archive"),
|
||||||
|
url(r'/archive-summary/(\d{4})/$', archive, {'summary': True}, "arch-summary"),
|
||||||
|
)
|
||||||
|
|
||||||
|
...you could refer to either the summary archive view in a template as::
|
||||||
|
|
||||||
|
{% url arch-summary 1945 %}
|
||||||
|
|
||||||
|
Even though both URL patterns refer to the ``archive`` view here, using the
|
||||||
|
``name`` parameter to ``url()`` allows you to tell them apart in templates.
|
||||||
|
|
||||||
|
The string used for the URL name can contain any characters you like. You are
|
||||||
|
not restricted to valid Python names.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Make sure that when you name your URLs, you use names that are unlikely to
|
||||||
|
clash with any other application's choice of names. If you call your URL
|
||||||
|
pattern *comment* and another application does the same thing, there is no
|
||||||
|
guarantee which URL will be inserted into your template when you use this
|
||||||
|
name. Putting a prefix on your URL names, perhaps derived from
|
||||||
|
the application name, will decrease the chances of collision. Something
|
||||||
|
like *myapp-comment* is recommended over simply *comment*.
|
||||||
|
|
||||||
|
53
docs/webdesign.txt
Normal file
53
docs/webdesign.txt
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
========================
|
||||||
|
django.contrib.webdesign
|
||||||
|
========================
|
||||||
|
|
||||||
|
The ``django.contrib.webdesign`` package, part of the `"django.contrib" add-ons`_,
|
||||||
|
provides various Django helpers that are particularly useful to Web *designers*
|
||||||
|
(as opposed to developers).
|
||||||
|
|
||||||
|
At present, the package contains only a single template tag. If you have ideas
|
||||||
|
for Web-designer-friendly functionality in Django, please `suggest them`_.
|
||||||
|
|
||||||
|
.. _"django.contrib" add-ons: ../add_ons/
|
||||||
|
.. _suggest them: ../contributing/
|
||||||
|
|
||||||
|
Template tags
|
||||||
|
=============
|
||||||
|
|
||||||
|
To use these template tags, add ``'django.contrib.webdesign'`` to your
|
||||||
|
``INSTALLED_APPS`` setting. Once you've done that, use
|
||||||
|
``{% load webdesign %}`` in a template to give your template access to the tags.
|
||||||
|
|
||||||
|
|
||||||
|
lorem
|
||||||
|
=====
|
||||||
|
|
||||||
|
Displays random "lorem ipsum" Latin text. This is useful for providing sample
|
||||||
|
data in templates.
|
||||||
|
|
||||||
|
Usage::
|
||||||
|
|
||||||
|
{% lorem [count] [method] [random] %}
|
||||||
|
|
||||||
|
The ``{% lorem %}`` tag can be used with zero, one, two or three arguments.
|
||||||
|
The arguments are:
|
||||||
|
|
||||||
|
=========== =============================================================
|
||||||
|
Argument Description
|
||||||
|
=========== =============================================================
|
||||||
|
``count`` A number (or variable) containing the number of paragraphs or
|
||||||
|
words to generate (default is 1).
|
||||||
|
``method`` Either ``w`` for words, ``p`` for HTML paragraphs or ``b``
|
||||||
|
for plain-text paragraph blocks (default is ``b``).
|
||||||
|
``random`` The word ``random``, which if given, does not use the common
|
||||||
|
paragraph ("Lorem ipsum dolor sit amet...") when generating
|
||||||
|
text.
|
||||||
|
=========== =============================================================
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
* ``{% lorem %}`` will output the common "lorem ipsum" paragraph.
|
||||||
|
* ``{% lorem 3 p %}`` will output the common "lorem ipsum" paragraph
|
||||||
|
and two random paragraphs each wrapped in HTML ``<p>`` tags.
|
||||||
|
* ``{% lorem 2 w random %}`` will output two random Latin words.
|
@ -1,12 +1,14 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
#
|
#
|
||||||
# this file is *inserted* into the install section of the generated
|
# This file becomes the install section of the generated spec file.
|
||||||
# spec file
|
|
||||||
#
|
#
|
||||||
|
|
||||||
# this is, what dist.py normally does
|
# This is what dist.py normally does.
|
||||||
python setup.py install --root=${RPM_BUILD_ROOT} --record="INSTALLED_FILES"
|
python setup.py install --root=${RPM_BUILD_ROOT} --record="INSTALLED_FILES"
|
||||||
|
|
||||||
|
# Sort the filelist so that directories appear before files. This avoids
|
||||||
|
# duplicate filename problems on some systems.
|
||||||
|
touch DIRS
|
||||||
for i in `cat INSTALLED_FILES`; do
|
for i in `cat INSTALLED_FILES`; do
|
||||||
if [ -f ${RPM_BUILD_ROOT}/$i ]; then
|
if [ -f ${RPM_BUILD_ROOT}/$i ]; then
|
||||||
echo $i >>FILES
|
echo $i >>FILES
|
||||||
@ -16,4 +18,6 @@ for i in `cat INSTALLED_FILES`; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
cat DIRS FILES >INSTALLED_FILES
|
# Make sure we match foo.pyo and foo.pyc along with foo.py (but only once each)
|
||||||
|
sed -e "/\.py[co]$/d" -e "s/\.py$/.py*/" DIRS FILES >INSTALLED_FILES
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[bdist_rpm]
|
[bdist_rpm]
|
||||||
doc_files = docs/*.txt
|
doc_files = docs examples extras AUTHORS INSTALL LICENSE README
|
||||||
install-script = scripts/rpm-install.sh
|
install-script = scripts/rpm-install.sh
|
||||||
|
|
||||||
|
37
setup.py
37
setup.py
@ -3,6 +3,20 @@ from distutils.command.install import INSTALL_SCHEMES
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
def fullsplit(path, result=None):
|
||||||
|
"""
|
||||||
|
Split a pathname into components (the opposite of os.path.join) in a
|
||||||
|
platform-neutral way.
|
||||||
|
"""
|
||||||
|
if result is None:
|
||||||
|
result = []
|
||||||
|
head, tail = os.path.split(path)
|
||||||
|
if head == '':
|
||||||
|
return [tail] + result
|
||||||
|
if head == path:
|
||||||
|
return result
|
||||||
|
return fullsplit(head, [tail] + result)
|
||||||
|
|
||||||
# Tell distutils to put the data_files in platform-specific installation
|
# Tell distutils to put the data_files in platform-specific installation
|
||||||
# locations. See here for an explanation:
|
# locations. See here for an explanation:
|
||||||
# http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
|
# http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
|
||||||
@ -13,27 +27,28 @@ for scheme in INSTALL_SCHEMES.values():
|
|||||||
# an easy way to do this.
|
# an easy way to do this.
|
||||||
packages, data_files = [], []
|
packages, data_files = [], []
|
||||||
root_dir = os.path.dirname(__file__)
|
root_dir = os.path.dirname(__file__)
|
||||||
len_root_dir = len(root_dir)
|
|
||||||
django_dir = os.path.join(root_dir, 'django')
|
django_dir = os.path.join(root_dir, 'django')
|
||||||
|
pieces = fullsplit(root_dir)
|
||||||
|
if pieces[-1] == '':
|
||||||
|
len_root_dir = len(pieces) - 1
|
||||||
|
else:
|
||||||
|
len_root_dir = len(pieces)
|
||||||
|
|
||||||
for dirpath, dirnames, filenames in os.walk(django_dir):
|
for dirpath, dirnames, filenames in os.walk(django_dir):
|
||||||
# Ignore dirnames that start with '.'
|
# Ignore dirnames that start with '.'
|
||||||
for i, dirname in enumerate(dirnames):
|
for i, dirname in enumerate(dirnames):
|
||||||
if dirname.startswith('.'): del dirnames[i]
|
if dirname.startswith('.'): del dirnames[i]
|
||||||
if '__init__.py' in filenames:
|
if '__init__.py' in filenames:
|
||||||
package = dirpath[len_root_dir:].lstrip('/').replace('/', '.')
|
packages.append('.'.join(fullsplit(dirpath)[len_root_dir:]))
|
||||||
packages.append(package)
|
elif filenames:
|
||||||
else:
|
|
||||||
data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
|
data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
|
||||||
|
|
||||||
# Small hack for working with bdist_wininst.
|
|
||||||
# See http://mail.python.org/pipermail/distutils-sig/2004-August/004134.html
|
|
||||||
if len(sys.argv) > 1 and sys.argv[1] == 'bdist_wininst':
|
|
||||||
for file_info in data_files:
|
|
||||||
file_info[0] = '/PURELIB/%s' % file_info[0]
|
|
||||||
|
|
||||||
# Dynamically calculate the version based on django.VERSION.
|
# Dynamically calculate the version based on django.VERSION.
|
||||||
version = "%d.%d-%s" % (__import__('django').VERSION)
|
version_tuple = __import__('django').VERSION
|
||||||
|
if version_tuple[2] is not None:
|
||||||
|
version = "%d.%d_%s" % version_tuple
|
||||||
|
else:
|
||||||
|
version = "%d.%d" % version_tuple[:2]
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = "Django",
|
name = "Django",
|
||||||
|
@ -97,6 +97,16 @@ class SelfClashM2M(models.Model):
|
|||||||
m2m_3 = models.ManyToManyField('self', symmetrical=False)
|
m2m_3 = models.ManyToManyField('self', symmetrical=False)
|
||||||
m2m_4 = models.ManyToManyField('self', symmetrical=False)
|
m2m_4 = models.ManyToManyField('self', symmetrical=False)
|
||||||
|
|
||||||
|
class Model(models.Model):
|
||||||
|
"But it's valid to call a model Model."
|
||||||
|
year = models.PositiveIntegerField() #1960
|
||||||
|
make = models.CharField(maxlength=10) #Aston Martin
|
||||||
|
name = models.CharField(maxlength=10) #DB 4 GT
|
||||||
|
|
||||||
|
class Car(models.Model):
|
||||||
|
colour = models.CharField(maxlength=5)
|
||||||
|
model = models.ForeignKey(Model)
|
||||||
|
|
||||||
model_errors = """invalid_models.fielderrors: "charfield": CharFields require a "maxlength" attribute.
|
model_errors = """invalid_models.fielderrors: "charfield": CharFields require a "maxlength" attribute.
|
||||||
invalid_models.fielderrors: "floatfield": FloatFields require a "decimal_places" attribute.
|
invalid_models.fielderrors: "floatfield": FloatFields require a "decimal_places" attribute.
|
||||||
invalid_models.fielderrors: "floatfield": FloatFields require a "max_digits" attribute.
|
invalid_models.fielderrors: "floatfield": FloatFields require a "max_digits" attribute.
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
r"""
|
r"""
|
||||||
>>> floatformat(7.7)
|
>>> floatformat(7.7)
|
||||||
'7.7'
|
'7.7'
|
||||||
@ -166,6 +168,9 @@ u'\xcb'
|
|||||||
>>> escape('<some html & special characters > here')
|
>>> escape('<some html & special characters > here')
|
||||||
'<some html & special characters > here'
|
'<some html & special characters > here'
|
||||||
|
|
||||||
|
>>> escape(u'<some html & special characters > here ĐÅ€£')
|
||||||
|
u'<some html & special characters > here \xc4\x90\xc3\x85\xe2\x82\xac\xc2\xa3'
|
||||||
|
|
||||||
>>> linebreaks('line 1')
|
>>> linebreaks('line 1')
|
||||||
'<p>line 1</p>'
|
'<p>line 1</p>'
|
||||||
|
|
||||||
|
0
tests/regressiontests/fixtures_regress/__init__.py
Normal file
0
tests/regressiontests/fixtures_regress/__init__.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"pk": "1",
|
||||||
|
"model": "fixtures_regress.animal",
|
||||||
|
"fields": {
|
||||||
|
"name": "Lion",
|
||||||
|
"latin_name": "Panthera leo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
22
tests/regressiontests/fixtures_regress/models.py
Normal file
22
tests/regressiontests/fixtures_regress/models.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class Animal(models.Model):
|
||||||
|
name = models.CharField(maxlength=150)
|
||||||
|
latin_name = models.CharField(maxlength=150)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.common_name
|
||||||
|
|
||||||
|
__test__ = {'API_TESTS':"""
|
||||||
|
>>> from django.core import management
|
||||||
|
|
||||||
|
# Load a fixture that uses PK=1
|
||||||
|
>>> management.load_data(['sequence'], verbosity=0)
|
||||||
|
|
||||||
|
# Create a new animal. Without a sequence reset, this new object
|
||||||
|
# will take a PK of 1 (on Postgres), and the save will fail.
|
||||||
|
# This is a regression test for ticket #3790.
|
||||||
|
>>> animal = Animal(name='Platypus', latin_name='Ornithorhynchus anatinus')
|
||||||
|
>>> animal.save()
|
||||||
|
|
||||||
|
"""}
|
885
tests/regressiontests/forms/localflavor.py
Normal file
885
tests/regressiontests/forms/localflavor.py
Normal file
File diff suppressed because one or more lines are too long
37
tests/regressiontests/forms/regressions.py
Normal file
37
tests/regressiontests/forms/regressions.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Tests to prevent against recurrences of earlier bugs.
|
||||||
|
|
||||||
|
regression_tests = r"""
|
||||||
|
It should be possible to re-use attribute dictionaries (#3810)
|
||||||
|
>>> from django.newforms import *
|
||||||
|
>>> extra_attrs = {'class': 'special'}
|
||||||
|
>>> class TestForm(Form):
|
||||||
|
... f1 = CharField(max_length=10, widget=TextInput(attrs=extra_attrs))
|
||||||
|
... f2 = CharField(widget=TextInput(attrs=extra_attrs))
|
||||||
|
>>> TestForm(auto_id=False).as_p()
|
||||||
|
u'<p>F1: <input type="text" class="special" name="f1" maxlength="10" /></p>\n<p>F2: <input type="text" class="special" name="f2" /></p>'
|
||||||
|
|
||||||
|
#######################
|
||||||
|
# Tests for form i18n #
|
||||||
|
#######################
|
||||||
|
There were some problems with form translations in #3600
|
||||||
|
|
||||||
|
>>> from django.utils.translation import gettext_lazy, activate, deactivate
|
||||||
|
>>> class SomeForm(Form):
|
||||||
|
... username = CharField(max_length=10, label=gettext_lazy('Username'))
|
||||||
|
>>> f = SomeForm()
|
||||||
|
>>> print f.as_p()
|
||||||
|
<p><label for="id_username">Username:</label> <input id="id_username" type="text" name="username" maxlength="10" /></p>
|
||||||
|
>>> activate('de')
|
||||||
|
>>> print f.as_p()
|
||||||
|
<p><label for="id_username">Benutzername:</label> <input id="id_username" type="text" name="username" maxlength="10" /></p>
|
||||||
|
>>> deactivate()
|
||||||
|
|
||||||
|
Unicode decoding problems...
|
||||||
|
>>> GENDERS = (('0', u'En tied\xe4'), ('1', u'Mies'), ('2', u'Nainen'))
|
||||||
|
>>> class SomeForm(Form):
|
||||||
|
... somechoice = ChoiceField(choices=GENDERS, widget=RadioSelect())
|
||||||
|
>>> f = SomeForm()
|
||||||
|
>>> f.as_p()
|
||||||
|
u'<p><label for="id_somechoice_0">Somechoice:</label> <ul>\n<li><label><input type="radio" id="id_somechoice_0" value="0" name="somechoice" /> En tied\xe4</label></li>\n<li><label><input type="radio" id="id_somechoice_1" value="1" name="somechoice" /> Mies</label></li>\n<li><label><input type="radio" id="id_somechoice_2" value="2" name="somechoice" /> Nainen</label></li>\n</ul></p>'
|
||||||
|
"""
|
@ -1,5 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
r"""
|
from localflavor import localflavor_tests
|
||||||
|
from regressions import regression_tests
|
||||||
|
|
||||||
|
form_tests = r"""
|
||||||
>>> from django.newforms import *
|
>>> from django.newforms import *
|
||||||
>>> import datetime
|
>>> import datetime
|
||||||
>>> import re
|
>>> import re
|
||||||
@ -1452,7 +1455,7 @@ u''
|
|||||||
>>> f.clean('http://www.google.com') # This will fail if there's no Internet connection
|
>>> f.clean('http://www.google.com') # This will fail if there's no Internet connection
|
||||||
u'http://www.google.com'
|
u'http://www.google.com'
|
||||||
|
|
||||||
EmailField also access min_length and max_length parameters, for convenience.
|
URLField also access min_length and max_length parameters, for convenience.
|
||||||
>>> f = URLField(min_length=15, max_length=20)
|
>>> f = URLField(min_length=15, max_length=20)
|
||||||
>>> f.clean('http://f.com')
|
>>> f.clean('http://f.com')
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
@ -3420,623 +3423,12 @@ True
|
|||||||
<option value="2016">2016</option>
|
<option value="2016">2016</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
# USZipCodeField ##############################################################
|
|
||||||
|
|
||||||
USZipCodeField validates that the data is either a five-digit U.S. zip code or
|
|
||||||
a zip+4.
|
|
||||||
>>> from django.contrib.localflavor.usa.forms import USZipCodeField
|
|
||||||
>>> f = USZipCodeField()
|
|
||||||
>>> f.clean('60606')
|
|
||||||
u'60606'
|
|
||||||
>>> f.clean(60606)
|
|
||||||
u'60606'
|
|
||||||
>>> f.clean('04000')
|
|
||||||
u'04000'
|
|
||||||
>>> f.clean('4000')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a zip code in the format XXXXX or XXXXX-XXXX.']
|
|
||||||
>>> f.clean('60606-1234')
|
|
||||||
u'60606-1234'
|
|
||||||
>>> f.clean('6060-1234')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a zip code in the format XXXXX or XXXXX-XXXX.']
|
|
||||||
>>> f.clean('60606-')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a zip code in the format XXXXX or XXXXX-XXXX.']
|
|
||||||
>>> f.clean(None)
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'This field is required.']
|
|
||||||
>>> f.clean('')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'This field is required.']
|
|
||||||
|
|
||||||
>>> f = USZipCodeField(required=False)
|
|
||||||
>>> f.clean('60606')
|
|
||||||
u'60606'
|
|
||||||
>>> f.clean(60606)
|
|
||||||
u'60606'
|
|
||||||
>>> f.clean('04000')
|
|
||||||
u'04000'
|
|
||||||
>>> f.clean('4000')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a zip code in the format XXXXX or XXXXX-XXXX.']
|
|
||||||
>>> f.clean('60606-1234')
|
|
||||||
u'60606-1234'
|
|
||||||
>>> f.clean('6060-1234')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a zip code in the format XXXXX or XXXXX-XXXX.']
|
|
||||||
>>> f.clean('60606-')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a zip code in the format XXXXX or XXXXX-XXXX.']
|
|
||||||
>>> f.clean(None)
|
|
||||||
u''
|
|
||||||
>>> f.clean('')
|
|
||||||
u''
|
|
||||||
|
|
||||||
# USPhoneNumberField ##########################################################
|
|
||||||
|
|
||||||
USPhoneNumberField validates that the data is a valid U.S. phone number,
|
|
||||||
including the area code. It's normalized to XXX-XXX-XXXX format.
|
|
||||||
>>> from django.contrib.localflavor.usa.forms import USPhoneNumberField
|
|
||||||
>>> f = USPhoneNumberField()
|
|
||||||
>>> f.clean('312-555-1212')
|
|
||||||
u'312-555-1212'
|
|
||||||
>>> f.clean('3125551212')
|
|
||||||
u'312-555-1212'
|
|
||||||
>>> f.clean('312 555-1212')
|
|
||||||
u'312-555-1212'
|
|
||||||
>>> f.clean('(312) 555-1212')
|
|
||||||
u'312-555-1212'
|
|
||||||
>>> f.clean('312 555 1212')
|
|
||||||
u'312-555-1212'
|
|
||||||
>>> f.clean('312.555.1212')
|
|
||||||
u'312-555-1212'
|
|
||||||
>>> f.clean('312.555-1212')
|
|
||||||
u'312-555-1212'
|
|
||||||
>>> f.clean(' (312) 555.1212 ')
|
|
||||||
u'312-555-1212'
|
|
||||||
>>> f.clean('555-1212')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Phone numbers must be in XXX-XXX-XXXX format.']
|
|
||||||
>>> f.clean('312-55-1212')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Phone numbers must be in XXX-XXX-XXXX format.']
|
|
||||||
>>> f.clean(None)
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'This field is required.']
|
|
||||||
>>> f.clean('')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'This field is required.']
|
|
||||||
|
|
||||||
>>> f = USPhoneNumberField(required=False)
|
|
||||||
>>> f.clean('312-555-1212')
|
|
||||||
u'312-555-1212'
|
|
||||||
>>> f.clean('3125551212')
|
|
||||||
u'312-555-1212'
|
|
||||||
>>> f.clean('312 555-1212')
|
|
||||||
u'312-555-1212'
|
|
||||||
>>> f.clean('(312) 555-1212')
|
|
||||||
u'312-555-1212'
|
|
||||||
>>> f.clean('312 555 1212')
|
|
||||||
u'312-555-1212'
|
|
||||||
>>> f.clean('312.555.1212')
|
|
||||||
u'312-555-1212'
|
|
||||||
>>> f.clean('312.555-1212')
|
|
||||||
u'312-555-1212'
|
|
||||||
>>> f.clean(' (312) 555.1212 ')
|
|
||||||
u'312-555-1212'
|
|
||||||
>>> f.clean('555-1212')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Phone numbers must be in XXX-XXX-XXXX format.']
|
|
||||||
>>> f.clean('312-55-1212')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Phone numbers must be in XXX-XXX-XXXX format.']
|
|
||||||
>>> f.clean(None)
|
|
||||||
u''
|
|
||||||
>>> f.clean('')
|
|
||||||
u''
|
|
||||||
|
|
||||||
# USStateField ################################################################
|
|
||||||
|
|
||||||
USStateField validates that the data is either an abbreviation or name of a
|
|
||||||
U.S. state.
|
|
||||||
>>> from django.contrib.localflavor.usa.forms import USStateField
|
|
||||||
>>> f = USStateField()
|
|
||||||
>>> f.clean('il')
|
|
||||||
u'IL'
|
|
||||||
>>> f.clean('IL')
|
|
||||||
u'IL'
|
|
||||||
>>> f.clean('illinois')
|
|
||||||
u'IL'
|
|
||||||
>>> f.clean(' illinois ')
|
|
||||||
u'IL'
|
|
||||||
>>> f.clean(60606)
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a U.S. state or territory.']
|
|
||||||
>>> f.clean(None)
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'This field is required.']
|
|
||||||
>>> f.clean('')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'This field is required.']
|
|
||||||
|
|
||||||
>>> f = USStateField(required=False)
|
|
||||||
>>> f.clean('il')
|
|
||||||
u'IL'
|
|
||||||
>>> f.clean('IL')
|
|
||||||
u'IL'
|
|
||||||
>>> f.clean('illinois')
|
|
||||||
u'IL'
|
|
||||||
>>> f.clean(' illinois ')
|
|
||||||
u'IL'
|
|
||||||
>>> f.clean(60606)
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a U.S. state or territory.']
|
|
||||||
>>> f.clean(None)
|
|
||||||
u''
|
|
||||||
>>> f.clean('')
|
|
||||||
u''
|
|
||||||
|
|
||||||
# USStateSelect ###############################################################
|
|
||||||
|
|
||||||
USStateSelect is a Select widget that uses a list of U.S. states/territories
|
|
||||||
as its choices.
|
|
||||||
>>> from django.contrib.localflavor.usa.forms import USStateSelect
|
|
||||||
>>> w = USStateSelect()
|
|
||||||
>>> print w.render('state', 'IL')
|
|
||||||
<select name="state">
|
|
||||||
<option value="AL">Alabama</option>
|
|
||||||
<option value="AK">Alaska</option>
|
|
||||||
<option value="AS">American Samoa</option>
|
|
||||||
<option value="AZ">Arizona</option>
|
|
||||||
<option value="AR">Arkansas</option>
|
|
||||||
<option value="CA">California</option>
|
|
||||||
<option value="CO">Colorado</option>
|
|
||||||
<option value="CT">Connecticut</option>
|
|
||||||
<option value="DE">Deleware</option>
|
|
||||||
<option value="DC">District of Columbia</option>
|
|
||||||
<option value="FM">Federated States of Micronesia</option>
|
|
||||||
<option value="FL">Florida</option>
|
|
||||||
<option value="GA">Georgia</option>
|
|
||||||
<option value="GU">Guam</option>
|
|
||||||
<option value="HI">Hawaii</option>
|
|
||||||
<option value="ID">Idaho</option>
|
|
||||||
<option value="IL" selected="selected">Illinois</option>
|
|
||||||
<option value="IN">Indiana</option>
|
|
||||||
<option value="IA">Iowa</option>
|
|
||||||
<option value="KS">Kansas</option>
|
|
||||||
<option value="KY">Kentucky</option>
|
|
||||||
<option value="LA">Louisiana</option>
|
|
||||||
<option value="ME">Maine</option>
|
|
||||||
<option value="MH">Marshall Islands</option>
|
|
||||||
<option value="MD">Maryland</option>
|
|
||||||
<option value="MA">Massachusetts</option>
|
|
||||||
<option value="MI">Michigan</option>
|
|
||||||
<option value="MN">Minnesota</option>
|
|
||||||
<option value="MS">Mississippi</option>
|
|
||||||
<option value="MO">Missouri</option>
|
|
||||||
<option value="MT">Montana</option>
|
|
||||||
<option value="NE">Nebraska</option>
|
|
||||||
<option value="NV">Nevada</option>
|
|
||||||
<option value="NH">New Hampshire</option>
|
|
||||||
<option value="NJ">New Jersey</option>
|
|
||||||
<option value="NM">New Mexico</option>
|
|
||||||
<option value="NY">New York</option>
|
|
||||||
<option value="NC">North Carolina</option>
|
|
||||||
<option value="ND">North Dakota</option>
|
|
||||||
<option value="MP">Northern Mariana Islands</option>
|
|
||||||
<option value="OH">Ohio</option>
|
|
||||||
<option value="OK">Oklahoma</option>
|
|
||||||
<option value="OR">Oregon</option>
|
|
||||||
<option value="PW">Palau</option>
|
|
||||||
<option value="PA">Pennsylvania</option>
|
|
||||||
<option value="PR">Puerto Rico</option>
|
|
||||||
<option value="RI">Rhode Island</option>
|
|
||||||
<option value="SC">South Carolina</option>
|
|
||||||
<option value="SD">South Dakota</option>
|
|
||||||
<option value="TN">Tennessee</option>
|
|
||||||
<option value="TX">Texas</option>
|
|
||||||
<option value="UT">Utah</option>
|
|
||||||
<option value="VT">Vermont</option>
|
|
||||||
<option value="VI">Virgin Islands</option>
|
|
||||||
<option value="VA">Virginia</option>
|
|
||||||
<option value="WA">Washington</option>
|
|
||||||
<option value="WV">West Virginia</option>
|
|
||||||
<option value="WI">Wisconsin</option>
|
|
||||||
<option value="WY">Wyoming</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
# UKPostcodeField #############################################################
|
|
||||||
|
|
||||||
UKPostcodeField validates that the data is a valid UK postcode.
|
|
||||||
>>> from django.contrib.localflavor.uk.forms import UKPostcodeField
|
|
||||||
>>> f = UKPostcodeField()
|
|
||||||
>>> f.clean('BT32 4PX')
|
|
||||||
u'BT32 4PX'
|
|
||||||
>>> f.clean('GIR 0AA')
|
|
||||||
u'GIR 0AA'
|
|
||||||
>>> f.clean('BT324PX')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a postcode. A space is required between the two postcode parts.']
|
|
||||||
>>> f.clean('1NV 4L1D')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a postcode. A space is required between the two postcode parts.']
|
|
||||||
>>> f.clean(None)
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'This field is required.']
|
|
||||||
>>> f.clean('')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'This field is required.']
|
|
||||||
|
|
||||||
>>> f = UKPostcodeField(required=False)
|
|
||||||
>>> f.clean('BT32 4PX')
|
|
||||||
u'BT32 4PX'
|
|
||||||
>>> f.clean('GIR 0AA')
|
|
||||||
u'GIR 0AA'
|
|
||||||
>>> f.clean('1NV 4L1D')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a postcode. A space is required between the two postcode parts.']
|
|
||||||
>>> f.clean('BT324PX')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a postcode. A space is required between the two postcode parts.']
|
|
||||||
>>> f.clean(None)
|
|
||||||
u''
|
|
||||||
>>> f.clean('')
|
|
||||||
u''
|
|
||||||
|
|
||||||
# FRZipCodeField #############################################################
|
|
||||||
|
|
||||||
FRZipCodeField validates that the data is a valid FR zipcode.
|
|
||||||
>>> from django.contrib.localflavor.fr.forms import FRZipCodeField
|
|
||||||
>>> f = FRZipCodeField()
|
|
||||||
>>> f.clean('75001')
|
|
||||||
u'75001'
|
|
||||||
>>> f.clean('93200')
|
|
||||||
u'93200'
|
|
||||||
>>> f.clean('2A200')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a zip code in the format XXXXX.']
|
|
||||||
>>> f.clean('980001')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a zip code in the format XXXXX.']
|
|
||||||
>>> f.clean(None)
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'This field is required.']
|
|
||||||
>>> f.clean('')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'This field is required.']
|
|
||||||
|
|
||||||
>>> f = FRZipCodeField(required=False)
|
|
||||||
>>> f.clean('75001')
|
|
||||||
u'75001'
|
|
||||||
>>> f.clean('93200')
|
|
||||||
u'93200'
|
|
||||||
>>> f.clean('2A200')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a zip code in the format XXXXX.']
|
|
||||||
>>> f.clean('980001')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a zip code in the format XXXXX.']
|
|
||||||
>>> f.clean(None)
|
|
||||||
u''
|
|
||||||
>>> f.clean('')
|
|
||||||
u''
|
|
||||||
|
|
||||||
|
|
||||||
# FRPhoneNumberField ##########################################################
|
|
||||||
|
|
||||||
FRPhoneNumberField validates that the data is a valid french phone number.
|
|
||||||
It's normalized to 0X XX XX XX XX format. Dots are valid too.
|
|
||||||
>>> from django.contrib.localflavor.fr.forms import FRPhoneNumberField
|
|
||||||
>>> f = FRPhoneNumberField()
|
|
||||||
>>> f.clean('01 55 44 58 64')
|
|
||||||
u'01 55 44 58 64'
|
|
||||||
>>> f.clean('0155445864')
|
|
||||||
u'01 55 44 58 64'
|
|
||||||
>>> f.clean('01 5544 5864')
|
|
||||||
u'01 55 44 58 64'
|
|
||||||
>>> f.clean('01 55.44.58.64')
|
|
||||||
u'01 55 44 58 64'
|
|
||||||
>>> f.clean('01.55.44.58.64')
|
|
||||||
u'01 55 44 58 64'
|
|
||||||
>>> f.clean('01,55,44,58,64')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Phone numbers must be in 0X XX XX XX XX format.']
|
|
||||||
>>> f.clean('555 015 544')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Phone numbers must be in 0X XX XX XX XX format.']
|
|
||||||
>>> f.clean(None)
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'This field is required.']
|
|
||||||
>>> f.clean('')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'This field is required.']
|
|
||||||
|
|
||||||
>>> f = FRPhoneNumberField(required=False)
|
|
||||||
>>> f.clean('01 55 44 58 64')
|
|
||||||
u'01 55 44 58 64'
|
|
||||||
>>> f.clean('0155445864')
|
|
||||||
u'01 55 44 58 64'
|
|
||||||
>>> f.clean('01 5544 5864')
|
|
||||||
u'01 55 44 58 64'
|
|
||||||
>>> f.clean('01 55.44.58.64')
|
|
||||||
u'01 55 44 58 64'
|
|
||||||
>>> f.clean('01.55.44.58.64')
|
|
||||||
u'01 55 44 58 64'
|
|
||||||
>>> f.clean('01,55,44,58,64')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Phone numbers must be in 0X XX XX XX XX format.']
|
|
||||||
>>> f.clean('555 015 544')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Phone numbers must be in 0X XX XX XX XX format.']
|
|
||||||
>>> f.clean(None)
|
|
||||||
u''
|
|
||||||
>>> f.clean('')
|
|
||||||
u''
|
|
||||||
|
|
||||||
# FRDepartmentSelect ###############################################################
|
|
||||||
|
|
||||||
FRDepartmentSelect is a Select widget that uses a list of french departments
|
|
||||||
including DOM TOM
|
|
||||||
>>> from django.contrib.localflavor.fr.forms import FRDepartmentSelect
|
|
||||||
>>> w = FRDepartmentSelect()
|
|
||||||
>>> print w.render('dep', 'Paris')
|
|
||||||
<select name="dep">
|
|
||||||
<option value="01">01 - Ain</option>
|
|
||||||
<option value="02">02 - Aisne</option>
|
|
||||||
<option value="03">03 - Allier</option>
|
|
||||||
<option value="04">04 - Alpes-de-Haute-Provence</option>
|
|
||||||
<option value="05">05 - Hautes-Alpes</option>
|
|
||||||
<option value="06">06 - Alpes-Maritimes</option>
|
|
||||||
<option value="07">07 - Ardeche</option>
|
|
||||||
<option value="08">08 - Ardennes</option>
|
|
||||||
<option value="09">09 - Ariege</option>
|
|
||||||
<option value="10">10 - Aube</option>
|
|
||||||
<option value="11">11 - Aude</option>
|
|
||||||
<option value="12">12 - Aveyron</option>
|
|
||||||
<option value="13">13 - Bouches-du-Rhone</option>
|
|
||||||
<option value="14">14 - Calvados</option>
|
|
||||||
<option value="15">15 - Cantal</option>
|
|
||||||
<option value="16">16 - Charente</option>
|
|
||||||
<option value="17">17 - Charente-Maritime</option>
|
|
||||||
<option value="18">18 - Cher</option>
|
|
||||||
<option value="19">19 - Correze</option>
|
|
||||||
<option value="21">21 - Cote-d'Or</option>
|
|
||||||
<option value="22">22 - Cotes-d'Armor</option>
|
|
||||||
<option value="23">23 - Creuse</option>
|
|
||||||
<option value="24">24 - Dordogne</option>
|
|
||||||
<option value="25">25 - Doubs</option>
|
|
||||||
<option value="26">26 - Drome</option>
|
|
||||||
<option value="27">27 - Eure</option>
|
|
||||||
<option value="28">28 - Eure-et-Loire</option>
|
|
||||||
<option value="29">29 - Finistere</option>
|
|
||||||
<option value="2A">2A - Corse-du-Sud</option>
|
|
||||||
<option value="2B">2B - Haute-Corse</option>
|
|
||||||
<option value="30">30 - Gard</option>
|
|
||||||
<option value="31">31 - Haute-Garonne</option>
|
|
||||||
<option value="32">32 - Gers</option>
|
|
||||||
<option value="33">33 - Gironde</option>
|
|
||||||
<option value="34">34 - Herault</option>
|
|
||||||
<option value="35">35 - Ille-et-Vilaine</option>
|
|
||||||
<option value="36">36 - Indre</option>
|
|
||||||
<option value="37">37 - Indre-et-Loire</option>
|
|
||||||
<option value="38">38 - Isere</option>
|
|
||||||
<option value="39">39 - Jura</option>
|
|
||||||
<option value="40">40 - Landes</option>
|
|
||||||
<option value="41">41 - Loir-et-Cher</option>
|
|
||||||
<option value="42">42 - Loire</option>
|
|
||||||
<option value="43">43 - Haute-Loire</option>
|
|
||||||
<option value="44">44 - Loire-Atlantique</option>
|
|
||||||
<option value="45">45 - Loiret</option>
|
|
||||||
<option value="46">46 - Lot</option>
|
|
||||||
<option value="47">47 - Lot-et-Garonne</option>
|
|
||||||
<option value="48">48 - Lozere</option>
|
|
||||||
<option value="49">49 - Maine-et-Loire</option>
|
|
||||||
<option value="50">50 - Manche</option>
|
|
||||||
<option value="51">51 - Marne</option>
|
|
||||||
<option value="52">52 - Haute-Marne</option>
|
|
||||||
<option value="53">53 - Mayenne</option>
|
|
||||||
<option value="54">54 - Meurthe-et-Moselle</option>
|
|
||||||
<option value="55">55 - Meuse</option>
|
|
||||||
<option value="56">56 - Morbihan</option>
|
|
||||||
<option value="57">57 - Moselle</option>
|
|
||||||
<option value="58">58 - Nievre</option>
|
|
||||||
<option value="59">59 - Nord</option>
|
|
||||||
<option value="60">60 - Oise</option>
|
|
||||||
<option value="61">61 - Orne</option>
|
|
||||||
<option value="62">62 - Pas-de-Calais</option>
|
|
||||||
<option value="63">63 - Puy-de-Dome</option>
|
|
||||||
<option value="64">64 - Pyrenees-Atlantiques</option>
|
|
||||||
<option value="65">65 - Hautes-Pyrenees</option>
|
|
||||||
<option value="66">66 - Pyrenees-Orientales</option>
|
|
||||||
<option value="67">67 - Bas-Rhin</option>
|
|
||||||
<option value="68">68 - Haut-Rhin</option>
|
|
||||||
<option value="69">69 - Rhone</option>
|
|
||||||
<option value="70">70 - Haute-Saone</option>
|
|
||||||
<option value="71">71 - Saone-et-Loire</option>
|
|
||||||
<option value="72">72 - Sarthe</option>
|
|
||||||
<option value="73">73 - Savoie</option>
|
|
||||||
<option value="74">74 - Haute-Savoie</option>
|
|
||||||
<option value="75">75 - Paris</option>
|
|
||||||
<option value="76">76 - Seine-Maritime</option>
|
|
||||||
<option value="77">77 - Seine-et-Marne</option>
|
|
||||||
<option value="78">78 - Yvelines</option>
|
|
||||||
<option value="79">79 - Deux-Sevres</option>
|
|
||||||
<option value="80">80 - Somme</option>
|
|
||||||
<option value="81">81 - Tarn</option>
|
|
||||||
<option value="82">82 - Tarn-et-Garonne</option>
|
|
||||||
<option value="83">83 - Var</option>
|
|
||||||
<option value="84">84 - Vaucluse</option>
|
|
||||||
<option value="85">85 - Vendee</option>
|
|
||||||
<option value="86">86 - Vienne</option>
|
|
||||||
<option value="87">87 - Haute-Vienne</option>
|
|
||||||
<option value="88">88 - Vosges</option>
|
|
||||||
<option value="89">89 - Yonne</option>
|
|
||||||
<option value="90">90 - Territoire de Belfort</option>
|
|
||||||
<option value="91">91 - Essonne</option>
|
|
||||||
<option value="92">92 - Hauts-de-Seine</option>
|
|
||||||
<option value="93">93 - Seine-Saint-Denis</option>
|
|
||||||
<option value="94">94 - Val-de-Marne</option>
|
|
||||||
<option value="95">95 - Val-d'Oise</option>
|
|
||||||
<option value="2A">2A - Corse du sud</option>
|
|
||||||
<option value="2B">2B - Haute Corse</option>
|
|
||||||
<option value="971">971 - Guadeloupe</option>
|
|
||||||
<option value="972">972 - Martinique</option>
|
|
||||||
<option value="973">973 - Guyane</option>
|
|
||||||
<option value="974">974 - La Reunion</option>
|
|
||||||
<option value="975">975 - Saint-Pierre-et-Miquelon</option>
|
|
||||||
<option value="976">976 - Mayotte</option>
|
|
||||||
<option value="984">984 - Terres Australes et Antarctiques</option>
|
|
||||||
<option value="986">986 - Wallis et Futuna</option>
|
|
||||||
<option value="987">987 - Polynesie Francaise</option>
|
|
||||||
<option value="988">988 - Nouvelle-Caledonie</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
# JPPostalCodeField ###############################################################
|
|
||||||
|
|
||||||
A form field that validates its input is a Japanese postcode.
|
|
||||||
|
|
||||||
Accepts 7 digits(with/out hyphen).
|
|
||||||
>>> from django.contrib.localflavor.jp.forms import JPPostalCodeField
|
|
||||||
>>> f = JPPostalCodeField()
|
|
||||||
>>> f.clean('251-0032')
|
|
||||||
u'2510032'
|
|
||||||
>>> f.clean('2510032')
|
|
||||||
u'2510032'
|
|
||||||
>>> f.clean('2510-032')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a postal code in the format XXXXXXX or XXX-XXXX.']
|
|
||||||
>>> f.clean('251a0032')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a postal code in the format XXXXXXX or XXX-XXXX.']
|
|
||||||
>>> f.clean('a51-0032')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a postal code in the format XXXXXXX or XXX-XXXX.']
|
|
||||||
>>> f.clean('25100321')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a postal code in the format XXXXXXX or XXX-XXXX.']
|
|
||||||
>>> f.clean('')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'This field is required.']
|
|
||||||
|
|
||||||
>>> f = JPPostalCodeField(required=False)
|
|
||||||
>>> f.clean('251-0032')
|
|
||||||
u'2510032'
|
|
||||||
>>> f.clean('2510032')
|
|
||||||
u'2510032'
|
|
||||||
>>> f.clean('2510-032')
|
|
||||||
Traceback (most recent call last):
|
|
||||||
...
|
|
||||||
ValidationError: [u'Enter a postal code in the format XXXXXXX or XXX-XXXX.']
|
|
||||||
>>> f.clean('')
|
|
||||||
u''
|
|
||||||
>>> f.clean(None)
|
|
||||||
u''
|
|
||||||
|
|
||||||
# JPPrefectureSelect ###############################################################
|
|
||||||
|
|
||||||
A Select widget that uses a list of Japanese prefectures as its choices.
|
|
||||||
>>> from django.contrib.localflavor.jp.forms import JPPrefectureSelect
|
|
||||||
>>> w = JPPrefectureSelect()
|
|
||||||
>>> print w.render('prefecture', 'kanagawa')
|
|
||||||
<select name="prefecture">
|
|
||||||
<option value="hokkaido">Hokkaido</option>
|
|
||||||
<option value="aomori">Aomori</option>
|
|
||||||
<option value="iwate">Iwate</option>
|
|
||||||
<option value="miyagi">Miyagi</option>
|
|
||||||
<option value="akita">Akita</option>
|
|
||||||
<option value="yamagata">Yamagata</option>
|
|
||||||
<option value="fukushima">Fukushima</option>
|
|
||||||
<option value="ibaraki">Ibaraki</option>
|
|
||||||
<option value="tochigi">Tochigi</option>
|
|
||||||
<option value="gunma">Gunma</option>
|
|
||||||
<option value="saitama">Saitama</option>
|
|
||||||
<option value="chiba">Chiba</option>
|
|
||||||
<option value="tokyo">Tokyo</option>
|
|
||||||
<option value="kanagawa" selected="selected">Kanagawa</option>
|
|
||||||
<option value="yamanashi">Yamanashi</option>
|
|
||||||
<option value="nagano">Nagano</option>
|
|
||||||
<option value="niigata">Niigata</option>
|
|
||||||
<option value="toyama">Toyama</option>
|
|
||||||
<option value="ishikawa">Ishikawa</option>
|
|
||||||
<option value="fukui">Fukui</option>
|
|
||||||
<option value="gifu">Gifu</option>
|
|
||||||
<option value="shizuoka">Shizuoka</option>
|
|
||||||
<option value="aichi">Aichi</option>
|
|
||||||
<option value="mie">Mie</option>
|
|
||||||
<option value="shiga">Shiga</option>
|
|
||||||
<option value="kyoto">Kyoto</option>
|
|
||||||
<option value="osaka">Osaka</option>
|
|
||||||
<option value="hyogo">Hyogo</option>
|
|
||||||
<option value="nara">Nara</option>
|
|
||||||
<option value="wakayama">Wakayama</option>
|
|
||||||
<option value="tottori">Tottori</option>
|
|
||||||
<option value="shimane">Shimane</option>
|
|
||||||
<option value="okayama">Okayama</option>
|
|
||||||
<option value="hiroshima">Hiroshima</option>
|
|
||||||
<option value="yamaguchi">Yamaguchi</option>
|
|
||||||
<option value="tokushima">Tokushima</option>
|
|
||||||
<option value="kagawa">Kagawa</option>
|
|
||||||
<option value="ehime">Ehime</option>
|
|
||||||
<option value="kochi">Kochi</option>
|
|
||||||
<option value="fukuoka">Fukuoka</option>
|
|
||||||
<option value="saga">Saga</option>
|
|
||||||
<option value="nagasaki">Nagasaki</option>
|
|
||||||
<option value="kumamoto">Kumamoto</option>
|
|
||||||
<option value="oita">Oita</option>
|
|
||||||
<option value="miyazaki">Miyazaki</option>
|
|
||||||
<option value="kagoshima">Kagoshima</option>
|
|
||||||
<option value="okinawa">Okinawa</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
#################################
|
#################################
|
||||||
# Tests of underlying functions #
|
# Tests of underlying functions #
|
||||||
#################################
|
#################################
|
||||||
|
|
||||||
# smart_unicode tests
|
# smart_unicode tests
|
||||||
>>> from django.newforms.util import smart_unicode
|
>>> from django.utils.encoding import smart_unicode
|
||||||
>>> class Test:
|
>>> class Test:
|
||||||
... def __str__(self):
|
... def __str__(self):
|
||||||
... return 'ŠĐĆŽćžšđ'
|
... return 'ŠĐĆŽćžšđ'
|
||||||
@ -4055,6 +3447,12 @@ u'1'
|
|||||||
u'foo'
|
u'foo'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__test__ = {
|
||||||
|
'form_tests': form_tests,
|
||||||
|
'localflavor': localflavor_tests,
|
||||||
|
'regressions': regression_tests,
|
||||||
|
}
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import doctest
|
import doctest
|
||||||
doctest.testmod()
|
doctest.testmod()
|
||||||
|
@ -27,8 +27,10 @@ should've produced %s""" % (method, rendered, result_list[index]))
|
|||||||
self.humanize_tester(test_list, result_list, 'ordinal')
|
self.humanize_tester(test_list, result_list, 'ordinal')
|
||||||
|
|
||||||
def test_intcomma(self):
|
def test_intcomma(self):
|
||||||
test_list = ('100','1000','10123','10311','1000000')
|
test_list = (100, 1000, 10123, 10311, 1000000, 1234567.25,
|
||||||
result_list = ('100', '1,000', '10,123', '10,311', '1,000,000')
|
'100', '1000', '10123', '10311', '1000000', '1234567.1234567')
|
||||||
|
result_list = ('100', '1,000', '10,123', '10,311', '1,000,000', '1,234,567.25',
|
||||||
|
'100', '1,000', '10,123', '10,311', '1,000,000', '1,234,567.1234567')
|
||||||
|
|
||||||
self.humanize_tester(test_list, result_list, 'intcomma')
|
self.humanize_tester(test_list, result_list, 'intcomma')
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user