1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

boulder-oracle-sprint: Merged to [4905].

git-svn-id: http://code.djangoproject.com/svn/django/branches/boulder-oracle-sprint@4906 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Boulder Sprinters 2007-04-02 15:36:31 +00:00
parent b86d69f529
commit a3053273c8
65 changed files with 4729 additions and 2823 deletions

View File

@ -64,9 +64,11 @@ answer newbie questions, and generally made Django that much better:
Chris Chamberlin <dja@cdc.msbx.net>
Amit Chakradeo <http://amit.chakradeo.net/>
ChaosKCW
ivan.chelubeev@gmail.com
Ian Clelland <clelland@gmail.com>
crankycoder@gmail.com
Matt Croydon <http://www.postneo.com/>
flavio.curella@gmail.com
Jure Cuhalev <gandalf@owca.info>
dackze+django@gmail.com
Dirk Datzert <dummy@habmalnefrage.de>
@ -154,6 +156,7 @@ answer newbie questions, and generally made Django that much better:
oggie rob <oz.robharvey@gmail.com>
Jay Parlar <parlar@gmail.com>
pavithran s <pavithran.s@gmail.com>
Barry Pederson <bp@barryp.org>
pgross@thoughtworks.com
phaedo <http://phaedo.cx/>
phil@produxion.net
@ -177,13 +180,16 @@ answer newbie questions, and generally made Django that much better:
SmileyChris <smileychris@gmail.com>
smurf@smurf.noris.de
sopel
Wiliam Alves de Souza <wiliamsouza83@gmail.com>
Georgi Stanojevski <glisha@gmail.com>
Thomas Steinacher <http://www.eggdrop.ch/>
nowell strite
Radek Švarz <http://www.svarz.cz/translate/>
Swaroop C H <http://www.swaroopch.info>
Aaron Swartz <http://www.aaronsw.com/>
Ville Säävuori <http://www.unessa.net/>
Tyson Tate <tyson@fallingbullets.com>
thebjorn <bp@datakortet.no>
Tom Tobin
Joe Topjian <http://joe.terrarum.net/geek/code/python/django/>
torne-django@wolfpuppy.org.uk

File diff suppressed because it is too large Load Diff

View File

@ -673,19 +673,19 @@ msgstr "L'URL est un lien cassé."
#: contrib/humanize/templatetags/humanize.py:16
msgid "th"
msgstr "e"
msgstr "<sup>e</sup>"
#: contrib/humanize/templatetags/humanize.py:16
msgid "st"
msgstr "er"
msgstr "<sup>er</sup>"
#: contrib/humanize/templatetags/humanize.py:16
msgid "nd"
msgstr "d"
msgstr "<sup>d</sup>"
#: contrib/humanize/templatetags/humanize.py:16
msgid "rd"
msgstr "e"
msgstr "<sup>e</sup>"
#: contrib/humanize/templatetags/humanize.py:48
#, python-format
@ -1346,7 +1346,7 @@ msgstr "Sélectionnez %s pour changer"
#: contrib/admin/views/main.py:768
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:50
@ -1391,7 +1391,7 @@ msgstr "les objets `%(label)s.%(type)s en relation"
#: contrib/admin/views/doc.py:219
#, python-format
msgid "all %s"
msgstr ""
msgstr "tous les %s"
#: contrib/admin/views/doc.py:224
#, python-format
@ -1401,7 +1401,7 @@ msgstr "nombre de %s"
#: contrib/admin/views/doc.py:229
#, python-format
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:303 contrib/admin/views/doc.py:309
@ -1613,7 +1613,8 @@ msgid ""
"Something's wrong with your database installation. Make sure the appropriate "
"database tables have been created, and make sure the database is readable by "
"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
msgid "Go"
@ -1930,6 +1931,13 @@ msgid ""
"as \"internal\" (talk to your system administrator if you aren't sure if\n"
"your computer is \"internal\").</p>\n"
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
msgid "Documentation for this page"

View File

@ -1,5 +1,5 @@
# 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.
# makoto tsuyuki <mtsuyuki@gmail.com>, 2005,2006,2007.
#
@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Django 1.0\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"
"Last-Translator: makoto tsuyuki <mtsuyuki@gmail.com>\n"
"Language-Team: Japanese <django-ja@googlegroups.com>\n"
@ -92,70 +92,82 @@ msgid "Japanese"
msgstr "日本語"
#: conf/global_settings.py:58
msgid "Kannada"
msgstr "カンナダ語"
#: conf/global_settings.py:59
msgid "Latvian"
msgstr "ラトビア語"
#: conf/global_settings.py:59
#: conf/global_settings.py:60
msgid "Macedonian"
msgstr "マケドニア語"
#: conf/global_settings.py:60
#: conf/global_settings.py:61
msgid "Dutch"
msgstr "オランダ語"
#: conf/global_settings.py:61
#: conf/global_settings.py:62
msgid "Norwegian"
msgstr "ノルウェー語"
#: conf/global_settings.py:62
#: conf/global_settings.py:63
msgid "Polish"
msgstr "ポーランド語"
#: conf/global_settings.py:63
#: conf/global_settings.py:64
msgid "Portugese"
msgstr "ポルトガル語"
#: conf/global_settings.py:65
msgid "Brazilian"
msgstr "ブラジル語"
#: conf/global_settings.py:64
#: conf/global_settings.py:66
msgid "Romanian"
msgstr "ルーマニア語"
#: conf/global_settings.py:65
#: conf/global_settings.py:67
msgid "Russian"
msgstr "ロシア語"
#: conf/global_settings.py:66
#: conf/global_settings.py:68
msgid "Slovak"
msgstr "スロバキア語"
#: conf/global_settings.py:67
#: conf/global_settings.py:69
msgid "Slovenian"
msgstr "スロヴェニア語"
#: conf/global_settings.py:68
#: conf/global_settings.py:70
msgid "Serbian"
msgstr "セルビア語"
#: conf/global_settings.py:69
#: conf/global_settings.py:71
msgid "Swedish"
msgstr "スウェーデン語"
#: conf/global_settings.py:70
#: conf/global_settings.py:72
msgid "Tamil"
msgstr "タミル語"
#: conf/global_settings.py:71
#: conf/global_settings.py:73
msgid "Telugu"
msgstr "テルグ語"
#: conf/global_settings.py:74
msgid "Turkish"
msgstr "トルコ語"
#: conf/global_settings.py:72
#: conf/global_settings.py:75
msgid "Ukrainian"
msgstr "ウクライナ語"
#: conf/global_settings.py:73
#: conf/global_settings.py:76
msgid "Simplified Chinese"
msgstr "簡体字中国語"
#: conf/global_settings.py:74
#: conf/global_settings.py:77
msgid "Traditional Chinese"
msgstr "繁体字中国語"
@ -194,17 +206,17 @@ msgid "This year"
msgstr "今年"
#: contrib/admin/filterspecs.py:143 newforms/widgets.py:170
#: oldforms/__init__.py:572
#: oldforms/__init__.py:577
msgid "Yes"
msgstr "はい"
#: contrib/admin/filterspecs.py:143 newforms/widgets.py:170
#: oldforms/__init__.py:572
#: oldforms/__init__.py:577
msgid "No"
msgstr "いいえ"
#: contrib/admin/filterspecs.py:150 newforms/widgets.py:170
#: oldforms/__init__.py:572
#: oldforms/__init__.py:577
msgid "Unknown"
msgstr "不明"
@ -568,7 +580,8 @@ msgstr "確認のため、再度パスワードを入力してください。"
#: contrib/admin/templates/admin/auth/user/change_password.html:28
#, python-format
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
msgid "Bookmarklets"
@ -602,7 +615,6 @@ msgstr ""
msgid "Documentation for this page"
msgstr "このページのドキュメント"
# TODO
#: contrib/admin/templates/admin_doc/bookmarklets.html:20
msgid ""
"Jumps you from any page to the documentation for the view that generates "
@ -769,7 +781,7 @@ msgstr "現在:"
msgid "Change:"
msgstr "変更:"
#: contrib/admin/templatetags/admin_list.py:238
#: contrib/admin/templatetags/admin_list.py:247
msgid "All dates"
msgstr "いつでも"
@ -850,13 +862,13 @@ msgstr "アプリケーション %r が見つかりません"
#: contrib/admin/views/doc.py:171
#, python-format
msgid "Model %r not found in app %r"
msgstr "モデル %r が %r アプリケーションに見つかりません"
msgid "Model %(name)r not found in app %(label)r"
msgstr "モデル %(name)r が %(label)r アプリケーションに見つかりません"
#: contrib/admin/views/doc.py:183
#, python-format
msgid "the related `%s.%s` object"
msgstr "`%s.%s` (関連オブジェクト)"
msgid "the related `%(label)s.%(type)s` object"
msgstr "`%(label)s.%(type)s` (関連オブジェクト)"
#: contrib/admin/views/doc.py:183 contrib/admin/views/doc.py:205
#: contrib/admin/views/doc.py:219 contrib/admin/views/doc.py:224
@ -865,8 +877,8 @@ msgstr "モデル :"
#: contrib/admin/views/doc.py:214
#, python-format
msgid "related `%s.%s` objects"
msgstr "`%s.%s` (関連オブジェクト)"
msgid "related `%(label)s.%(name)s` objects"
msgstr "`%(label)s.%(name)s` (関連オブジェクト)"
#: contrib/admin/views/doc.py:219
#, python-format
@ -984,7 +996,7 @@ msgid "Added %s."
msgstr "%s を追加しました。"
#: 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"
msgstr "と"
@ -1018,41 +1030,41 @@ msgstr "%(name)s \"%(obj)s\" を追加しました。続けて編集できます
msgid "Change %s"
msgstr "%s を変更"
#: contrib/admin/views/main.py:473
#: contrib/admin/views/main.py:476
#, python-format
msgid "One or more %(fieldname)s in %(name)s: %(obj)s"
msgstr "%(name)s に %(fieldname)s が一つ以上あります: %(obj)s"
#: contrib/admin/views/main.py:478
#: contrib/admin/views/main.py:481
#, python-format
msgid "One or more %(fieldname)s in %(name)s:"
msgstr "%(name)s に %(fieldname)s が一つ以上あります:"
#: contrib/admin/views/main.py:511
#: contrib/admin/views/main.py:514
#, python-format
msgid "The %(name)s \"%(obj)s\" was deleted successfully."
msgstr "%(name)s \"%(obj)s\" を削除しました。"
#: contrib/admin/views/main.py:514
#: contrib/admin/views/main.py:517
msgid "Are you sure?"
msgstr "よろしいですか?"
#: contrib/admin/views/main.py:536
#: contrib/admin/views/main.py:539
#, python-format
msgid "Change history: %s"
msgstr "変更履歴: %s"
#: contrib/admin/views/main.py:570
#: contrib/admin/views/main.py:573
#, python-format
msgid "Select %s"
msgstr "%s を選択"
#: contrib/admin/views/main.py:570
#: contrib/admin/views/main.py:573
#, python-format
msgid "Select %s to change"
msgstr "変更する %s を選択"
#: contrib/admin/views/main.py:758
#: contrib/admin/views/main.py:768
msgid "Database error"
msgstr "データベースエラー"
@ -1147,8 +1159,8 @@ msgid ""
"Use '[algo]$[salt]$[hexdigest]' or use the <a href=\"password/\">change "
"password form</a>."
msgstr ""
"'[algo]$[salt]$[hexdigest]'形式か、"
"<a href=\"password/\">パスワード変更フォーム</a>を使ってください。"
"'[algo]$[salt]$[hexdigest]'形式か、<a href=\"password/\">パスワード変更フォー"
"ム</a>を使ってください。"
#: contrib/auth/models.py:95
msgid "staff status"
@ -1517,15 +1529,15 @@ msgstr "コメント ID が不正です"
msgid "No voting for yourself"
msgstr "自分には投票できません。"
#: contrib/contenttypes/models.py:26
#: contrib/contenttypes/models.py:36
msgid "python model class name"
msgstr "Python モデルクラス名"
#: contrib/contenttypes/models.py:29
#: contrib/contenttypes/models.py:39
msgid "content type"
msgstr "コンテンツタイプ"
#: contrib/contenttypes/models.py:30
#: contrib/contenttypes/models.py:40
msgid "content types"
msgstr "コンテンツタイプ"
@ -1575,7 +1587,281 @@ msgstr "フラットページ"
msgid "flat pages"
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."
msgstr "XXXXXか、XXXXX-XXXXの形式で郵便番号を入力してください。"
@ -1607,23 +1893,23 @@ msgstr "リダイレクト"
msgid "redirects"
msgstr "リダイレクト"
#: contrib/sessions/models.py:51
#: contrib/sessions/models.py:68
msgid "session key"
msgstr "セッションキー"
#: contrib/sessions/models.py:52
#: contrib/sessions/models.py:69
msgid "session data"
msgstr "セッションデータ"
#: contrib/sessions/models.py:53
#: contrib/sessions/models.py:70
msgid "expire date"
msgstr "有効期限"
#: contrib/sessions/models.py:57
#: contrib/sessions/models.py:74
msgid "session"
msgstr "セッション"
#: contrib/sessions/models.py:58
#: contrib/sessions/models.py:75
msgid "sessions"
msgstr "セッション"
@ -1704,31 +1990,31 @@ msgstr "1900年以降を指定してください。"
#: core/validators.py:143
#, python-format
msgid "Invalid date: %s."
msgid "Invalid date: %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."
msgstr "YYYY-MM-DD形式で日付を入力してください。"
#: core/validators.py:152
#: core/validators.py:153
msgid "Enter a valid time in HH:MM format."
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."
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."
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."
msgstr ""
"ファイルが取得できませんでした。formのencoding typeを確認してください。"
#: core/validators.py:177
#: core/validators.py:178
msgid ""
"Upload a valid image. The file you uploaded was either not an image or a "
"corrupted image."
@ -1736,26 +2022,26 @@ msgstr ""
"画像をアップロードしてください。アップロードした画像は画像でないか、または壊"
"れています。"
#: core/validators.py:184
#: core/validators.py:185
#, python-format
msgid "The URL %s does not point to a valid image."
msgstr "URL ( %s ) は画像ではありません。"
#: core/validators.py:188
#: core/validators.py:189
#, python-format
msgid "Phone numbers must be in XXX-XXX-XXXX format. \"%s\" is invalid."
msgstr "電話番号は XXX-XXX-XXXX 形式で入力してください。\"%s\" は無効です。"
#: core/validators.py:196
#: core/validators.py:197
#, python-format
msgid "The URL %s does not point to a valid QuickTime video."
msgstr "URL ( %s ) は QuickTime ビデオではありません。"
#: core/validators.py:200
#: core/validators.py:201
msgid "A valid URL is required."
msgstr "正しい URL を入力してください。"
#: core/validators.py:214
#: core/validators.py:215
#, python-format
msgid ""
"Valid HTML is required. Specific errors are:\n"
@ -1764,86 +2050,86 @@ msgstr ""
"有効な HTML を入力してください。エラー:\n"
"%s"
#: core/validators.py:221
#: core/validators.py:222
#, python-format
msgid "Badly formed XML: %s"
msgstr "不正な XML です: %s"
#: core/validators.py:238
#: core/validators.py:239
#, python-format
msgid "Invalid URL: %s"
msgstr "無効なURL: %s"
#: core/validators.py:243 core/validators.py:245
#: core/validators.py:244 core/validators.py:246
#, python-format
msgid "The URL %s is a broken link."
msgstr "URL ( %s ) はリンクが壊れています。"
#: core/validators.py:251
#: core/validators.py:252
msgid "Enter a valid U.S. state abbreviation."
msgstr "正しい米州略称を入力してください。"
#: core/validators.py:265
#: core/validators.py:266
#, python-format
msgid "Watch your mouth! The word %s is not allowed here."
msgid_plural "Watch your mouth! The words %s are not allowed here."
msgstr[0] "言葉使いに気を付けて! %s という言葉は使えません。"
msgstr[1] "言葉使いに気を付けて! %s という言葉は使えません。"
#: core/validators.py:272
#: core/validators.py:273
#, python-format
msgid "This field must match the '%s' field."
msgstr "このフィールドは '%s' フィールドと一致せねばなりません。"
#: core/validators.py:291
#: core/validators.py:292
msgid "Please enter something for at least one field."
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."
msgstr "両方のフィールドに入力するか、両方とも未入力にしてください。"
#: core/validators.py:318
#: core/validators.py:320
#, python-format
msgid "This field must be given if %(field)s is %(value)s"
msgstr ""
"%(field)s を %(value)s にするのなら、このフィールドに必ず入力してください。"
#: core/validators.py:330
#: core/validators.py:333
#, python-format
msgid "This field must be given if %(field)s is not %(value)s"
msgstr ""
"%(field)s を %(value)s にしないのなら、このフィールドに必ず入力してください。"
#: core/validators.py:349
#: core/validators.py:352
msgid "Duplicate values are not allowed."
msgstr "重複する値は認められません。"
#: core/validators.py:364
#: core/validators.py:367
#, python-format
msgid "This value must be between %s and %s."
msgstr "この値は %s から %s の間でなければなりません。"
msgid "This value must be between %(lower)s and %(upper)s."
msgstr "この値は %(lower)s から %(upper)s の間でなければなりません。"
#: core/validators.py:366
#: core/validators.py:369
#, python-format
msgid "This value must be at least %s."
msgstr "この値は %s 以上でなければなりません。"
#: core/validators.py:368
#: core/validators.py:371
#, python-format
msgid "This value must be no more than %s."
msgstr "この値は %s より小さくなければなりません。"
#: core/validators.py:404
#: core/validators.py:407
#, python-format
msgid "This value must be a power of %s."
msgstr "この値は %s の累乗でなければなりません。"
#: core/validators.py:415
#: core/validators.py:418
msgid "Please enter a valid decimal number."
msgstr "有効な 10 進数を入力してください。"
#: core/validators.py:419
#: core/validators.py:422
#, python-format
msgid "Please enter a valid decimal number with at most %s total digit."
msgid_plural ""
@ -1851,7 +2137,7 @@ msgid_plural ""
msgstr[0] "全体で %s 文字以下の数字を入力してください。"
msgstr[1] "全体で %s 文字以下の数字を入力してください。"
#: core/validators.py:422
#: core/validators.py:425
#, python-format
msgid ""
"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[1] "整数部は %s 文字以下の数字を入力してください。"
#: core/validators.py:425
#: core/validators.py:428
#, python-format
msgid "Please enter a valid decimal number with at most %s decimal place."
msgid_plural ""
@ -1868,37 +2154,37 @@ msgid_plural ""
msgstr[0] "小数部は %s 文字以下の数字を入力してください。"
msgstr[1] "小数部は %s 文字以下の数字を入力してください。"
#: core/validators.py:435
#: core/validators.py:438
#, python-format
msgid "Make sure your uploaded file is at least %s bytes big."
msgstr "アップロードするファイルの大きさは %s バイト以上にしてください。"
#: core/validators.py:436
#: core/validators.py:439
#, python-format
msgid "Make sure your uploaded file is at most %s bytes big."
msgstr "アップロードするファイルの大きさは %s 最大バイトまでです。"
#: core/validators.py:453
#: core/validators.py:456
msgid "The format for this field is wrong."
msgstr "フィールドの形式が正しくありません。"
#: core/validators.py:468
#: core/validators.py:471
msgid "This field is invalid."
msgstr "このフィールドは無効です。"
#: core/validators.py:504
#: core/validators.py:507
#, python-format
msgid "Could not retrieve anything from %s."
msgstr "%s から何も検索できませんでした。"
#: core/validators.py:507
#: core/validators.py:510
#, python-format
msgid ""
"The URL %(url)s returned the invalid Content-Type header '%(contenttype)s'."
msgstr ""
"URL %(url)s は無効なコンテンツタイプヘッダ '%(contenttype)s' を返しました。"
#: core/validators.py:540
#: core/validators.py:543
#, python-format
msgid ""
"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\" で始まる"
"行です)。"
#: core/validators.py:544
#: core/validators.py:547
#, python-format
msgid ""
"Some text starting on line %(line)s is not allowed in that context. (Line "
@ -1916,7 +2202,7 @@ msgstr ""
"%(line)s 行目から始まるテキストはこのコンテキストでは使えません。 (\"%(start)"
"s\" で始まる行です)。"
#: core/validators.py:549
#: core/validators.py:552
#, python-format
msgid ""
"\"%(attr)s\" on line %(line)s is an invalid attribute. (Line starts with \"%"
@ -1925,7 +2211,7 @@ msgstr ""
"%(line)s 行目の \"%(attr)s\" は無効なアトリビュートです (\"%(start)s\" で始ま"
"る行です)。"
#: core/validators.py:554
#: core/validators.py:557
#, python-format
msgid ""
"\"<%(tag)s>\" on line %(line)s is an invalid tag. (Line starts with \"%"
@ -1934,7 +2220,7 @@ msgstr ""
"%(line)s 行目の \"<%(tag)s>\" は無効なタグです( \"%(start)s\" で始まる行で"
"す)。"
#: core/validators.py:558
#: core/validators.py:561
#, python-format
msgid ""
"A tag on line %(line)s is missing one or more required attributes. (Line "
@ -1943,7 +2229,7 @@ msgstr ""
"%(line)s 行目のタグは必須アトリビュートが未入力です( \"%(start)s\" で始まる行"
"です)。"
#: core/validators.py:563
#: core/validators.py:566
#, python-format
msgid ""
"The \"%(attr)s\" attribute on line %(line)s has an invalid value. (Line "
@ -1952,7 +2238,7 @@ msgstr ""
"%(line)s 行目の \"%(attr)s\" アトリビュートの値が正しくありません (\"%(start)"
"s\" で始まる行です) 。"
#: db/models/manipulators.py:305
#: db/models/manipulators.py:307
#, python-format
msgid "%(object)s with this %(type)s already exists for the given %(field)s."
msgstr ""
@ -1963,29 +2249,33 @@ msgstr ""
msgid "%(optname)s with this %(fieldname)s already exists."
msgstr "%(fieldname)s に %(optname)s は既に存在します。"
#: db/models/fields/__init__.py:116 db/models/fields/__init__.py:273
#: db/models/fields/__init__.py:605 db/models/fields/__init__.py:616
#: newforms/fields.py:78 newforms/fields.py:373 newforms/fields.py:449
#: newforms/fields.py:460 oldforms/__init__.py:352
#: db/models/fields/__init__.py:117 db/models/fields/__init__.py:274
#: db/models/fields/__init__.py:610 db/models/fields/__init__.py:621
#: newforms/fields.py:78 newforms/fields.py:374 newforms/fields.py:450
#: newforms/fields.py:461 newforms/models.py:177 oldforms/__init__.py:357
msgid "This field is required."
msgstr "このフィールドは必須です。"
#: db/models/fields/__init__.py:366
#: db/models/fields/__init__.py:367
msgid "This value must be an integer."
msgstr "値は整数でなければなりません。"
#: db/models/fields/__init__.py:401
#: db/models/fields/__init__.py:402
msgid "This value must be either True or False."
msgstr "値は真: True または偽: False でなければなりません。"
#: db/models/fields/__init__.py:422
#: db/models/fields/__init__.py:423
msgid "This field cannot be null."
msgstr "このフィールドには NULL を指定できません。"
#: db/models/fields/__init__.py:625
#: db/models/fields/__init__.py:630
msgid "Enter a valid filename."
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
#, python-format
msgid "Please enter a valid %s."
@ -2054,55 +2344,79 @@ msgstr "URLを正しく入力してください。"
msgid "This URL appears to be a broken link."
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."
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."
msgstr "リストを入力してください。"
#: newforms/fields.py:386
#: newforms/fields.py:387 newforms/models.py:187
#, python-format
msgid "Select a valid choice. %s is not one of the available choices."
msgstr "正しく選択してください。 %s は候補にありません。"
#: oldforms/__init__.py:387
#: oldforms/__init__.py:392
#, python-format
msgid "Ensure your text is less than %s character."
msgid_plural "Ensure your text is less than %s characters."
msgstr[0] "%s 字以下で入力してください。"
msgstr[1] "%s 字以下で入力してください。"
#: oldforms/__init__.py:392
#: oldforms/__init__.py:397
msgid "Line breaks are not allowed here."
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
msgid "Select a valid choice; '%(data)s' is not in %(choices)s."
msgstr "正しく選択してください。; '%(data)s' は %(choices)s にありません。"
#: oldforms/__init__.py:669
#: oldforms/__init__.py:674
msgid "The submitted file is empty."
msgstr "入力されたファイルは空です。"
#: oldforms/__init__.py:725
#: oldforms/__init__.py:730
msgid "Enter a whole number between -32,768 and 32,767."
msgstr "-32,768 から 32,767 までの整数を入力してください。"
#: oldforms/__init__.py:735
#: oldforms/__init__.py:740
msgid "Enter a positive number."
msgstr "正の数を入力してください。"
#: oldforms/__init__.py:745
#: oldforms/__init__.py:750
msgid "Enter a whole number between 0 and 32,767."
msgstr "0 から 32,767 までの整数を入力してください。"
#: template/defaultfilters.py:436
#: template/defaultfilters.py:491
msgid "yes,no,maybe"
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
msgid "Monday"
msgstr "月曜日"

View File

@ -1,14 +1,12 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# Japanese translation for js.
# Copyright (C) 2005 makoto tsuyuki
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
# makoto tsuyuki <mtsuyuki@gmail.com>, 2005.
msgid ""
msgstr ""
"Project-Id-Version: Django 1.0\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"
"Last-Translator: makoto tsuyuki <mtsuyuki@gmail.com>\n"
"Language-Team: Japanese <django-ja@googlegroups.com>\n"
@ -85,7 +83,7 @@ msgstr "時間を選択"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:82
msgid "Midnight"
msgstr "夜中"
msgstr "0時"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:83
msgid "6 a.m."
@ -93,7 +91,7 @@ msgstr "午前 6 時"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:84
msgid "Noon"
msgstr "正午"
msgstr "12時"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:88
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:183

View File

@ -163,11 +163,11 @@ msgstr "ఫ్లాగ్ తేది "
#: contrib/comments/models.py:268
msgid "user flag"
msgstr "యూర్ ఫ్లాగ్"
msgstr "యూర్ ఫ్లాగ్"
#: contrib/comments/models.py:269
msgid "user flags"
msgstr "యూర్ ఫ్లాగులు"
msgstr "యూర్ ఫ్లాగులు"
#: contrib/comments/models.py:273
#, python-format
@ -193,7 +193,7 @@ msgstr "మొదరేటర్ తీసివేసిన %r"
#: contrib/comments/views/karma.py:19
msgid "Anonymous users cannot vote"
msgstr "అపరిచిత యూఙరులు వోటు వేయలేరు"
msgstr "అపరిచిత యూజర్లు వోటు వేయలేరు"
#: contrib/comments/views/karma.py:23
msgid "Invalid comment ID"
@ -220,12 +220,12 @@ msgid_plural ""
"\n"
"%(text)s"
msgstr[0] ""
"ఈ వ్యాఖ్యానము చేసిన యూర్ %(count)లు కన్న తక్కువ సమర్పించాడు "
"ఈ వ్యాఖ్యానము చేసిన యూర్ %(count)లు కన్న తక్కువ సమర్పించాడు "
"వ్యాఖ్యానము:\n"
"\n"
"%(text)s"
msgstr[1] ""
"ఈ వ్యాఖ్యానము చేసిన యూర్ %(count)లు కన్న తక్కువ సమర్పించాడు"
"ఈ వ్యాఖ్యానము చేసిన యూర్ %(count)లు కన్న తక్కువ సమర్పించాడు"
"వ్యాఖ్యానములు:\n"
"\n"
"%(text)s"
@ -237,7 +237,7 @@ msgid ""
"\n"
"%(text)s"
msgstr ""
"ఈ వ్యాఖ్యానము స్కెచి యూర్ చేసాడు :\n"
"ఈ వ్యాఖ్యానము స్కెచి యూర్ చేసాడు :\n"
"\n"
"%(text)s"
@ -274,7 +274,7 @@ msgstr "వ్యాఖ్యానము ఫార్మ్ లో 'ప్ర
#: contrib/comments/templates/comments/form.html:8
#: contrib/admin/templates/admin/login.html:17
msgid "Username:"
msgstr "యూర్ పేరు"
msgstr "యూర్ పేరు"
#: contrib/comments/templates/comments/form.html:6
#: contrib/admin/templates/admin/object_history.html:3
@ -353,15 +353,15 @@ msgstr "అన్నీ"
#: contrib/admin/filterspecs.py:109
msgid "Any date"
msgstr "ఏ రోైన"
msgstr "ఏ రోైన"
#: contrib/admin/filterspecs.py:110
msgid "Today"
msgstr "ఈ రోు"
msgstr "ఈ రోు"
#: contrib/admin/filterspecs.py:113
msgid "Past 7 days"
msgstr "గత 7 రోుల గా"
msgstr "గత 7 రోుల గా"
#: contrib/admin/filterspecs.py:115
msgid "This month"
@ -413,13 +413,13 @@ msgstr "లాగ్ ఎంట్రీలు"
#: contrib/admin/templatetags/admin_list.py:230
msgid "All dates"
msgstr "అన్నీ రోులు"
msgstr "అన్నీ రోులు"
#: contrib/admin/views/decorators.py:10 contrib/auth/forms.py:59
msgid ""
"Please enter a correct username and password. Note that both fields are case-"
"sensitive."
msgstr "దయచేసి సరైన యూర్ పేరు పాస్ వర్డ్ ఇవ్వండి"
msgstr "దయచేసి సరైన యూర్ పేరు పాస్ వర్డ్ ఇవ్వండి"
#: contrib/admin/views/decorators.py:24
#: contrib/admin/templates/admin/login.html:25
@ -430,22 +430,22 @@ msgstr "లాగ్ ఇన్"
msgid ""
"Please log in again, because your session has expired. Don't worry: Your "
"submission has been saved."
msgstr "దయచేసి మళీ లాగ్ ఇన్ అవ్వండి ఎందుకంటే మీ సేస్సన్ ముగిసింది . బాధపడకండి మీ సమర్పన దాచిపెట్టాము"
msgstr "దయచేసి మళ్ళీ లాగ్ ఇన్ అవ్వండి ఎందుకంటే మీ సేస్సన్ ముగిసింది . బాధపడకండి మీ సమర్పన దాచిపెట్టాము"
#: contrib/admin/views/decorators.py:69
msgid ""
"Looks like your browser isn't configured to accept cookies. Please enable "
"cookies, reload this page, and try again."
msgstr "మీ బ్రౌర్ పై కుకీస్ అంగీకరించబడేటట్లు చేయలేదు . దయ చేసి కుకీస్ ఎనేబల్ చేసి ,మళ్ళీ ట్రై చేయండి"
msgstr "మీ బ్రౌర్ పై కుకీస్ అంగీకరించేటట్లు చేయలేదు . దయ చేసి కుకీస్ ఎనేబల్ చేసి ,మళ్ళీ ట్రై చేయండి"
#: contrib/admin/views/decorators.py:83
msgid "Usernames cannot contain the '@' character."
msgstr "యూర్ పేరు లో '@' అక్షరము ఉందకూడడు"
msgstr "యూర్ పేరు లో '@' అక్షరము ఉందకూడడు"
#: contrib/admin/views/decorators.py:85
#, python-format
msgid "Your e-mail address is not your username. Try '%s' instead."
msgstr "మీ ఈ మెయిల్ అడ్రస్ మీ యూర్ పేరు కాదు . '%s' ఇచ్చి చూడండి "
msgstr "మీ ఈ మెయిల్ అడ్రస్ మీ యూర్ పేరు కాదు . '%s' ఇచ్చి చూడండి "
#: contrib/admin/views/main.py:223
msgid "Site administration"
@ -454,7 +454,7 @@ msgstr "సైట్ నిర్వాహన"
#: contrib/admin/views/main.py:257 contrib/admin/views/auth.py:17
#, python-format
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/auth.py:22
@ -464,12 +464,12 @@ msgstr "మీరు మళ్ళీ దీనినీ క్రింద మ
#: contrib/admin/views/main.py:271 contrib/admin/views/main.py:356
#, python-format
msgid "You may add another %s below."
msgstr "మీరు ఇంకొక %s ని క్రింద త చేయొచ్చు"
msgstr "మీరు ఇంకొక %s ని క్రింద త చేయొచ్చు"
#: contrib/admin/views/main.py:289
#, python-format
msgid "Add %s"
msgstr "%s ని త చేయండి "
msgstr "%s ని త చేయండి "
#: contrib/admin/views/main.py:335
#, python-format
@ -493,17 +493,17 @@ msgstr "%s తీసివేయబడ్డడి"
#: contrib/admin/views/main.py:342
msgid "No fields changed."
msgstr "మార్చబడలేదు"
msgstr "ఫీల్డ్స్ ఏమి మార్చబడలేదు"
#: contrib/admin/views/main.py:345
#, python-format
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
#, python-format
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
#, python-format
@ -523,7 +523,7 @@ msgstr "ఒకటి కాని ,అంత కన్నఎక్కువ %(
#: contrib/admin/views/main.py:511
#, python-format
msgid "The %(name)s \"%(obj)s\" was deleted successfully."
msgstr "%(name)లు \"%(obj)s\"యప్రదంగా తీసివేయబడ్డడి"
msgstr "%(name)లు \"%(obj)s\"యప్రదంగా తీసివేయబడ్డడి"
#: contrib/admin/views/main.py:514
msgid "Are you sure?"
@ -601,7 +601,7 @@ msgstr ""
#: contrib/admin/views/doc.py:229
#, python-format
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:303 contrib/admin/views/doc.py:309
@ -682,7 +682,7 @@ msgstr ""
#: contrib/admin/views/auth.py:28
msgid "Add user"
msgstr "యూఙర్"
msgstr "యూజర్ ని జత చేయండి"
#: contrib/admin/templates/admin/object_history.html:3
#: contrib/admin/templates/admin/change_list.html:5
@ -742,7 +742,7 @@ msgstr "తేది/వేళ"
#: contrib/admin/templates/admin/object_history.html:19
msgid "User"
msgstr "యూర్"
msgstr "యూర్"
#: contrib/admin/templates/admin/object_history.html:20
msgid "Action"
@ -760,11 +760,11 @@ msgstr ""
#: contrib/admin/templates/admin/base_site.html:4
msgid "Django site admin"
msgstr "డ్ాంగొ యొక్క నిర్వాహనదారులు"
msgstr "డ్ాంగొ యొక్క నిర్వాహనదారులు"
#: contrib/admin/templates/admin/base_site.html:7
msgid "Django administration"
msgstr "డ్ాంగొ నిర్వాహన"
msgstr "డ్ాంగొ నిర్వాహన"
#: contrib/admin/templates/admin/500.html:4
msgid "Server error"
@ -782,16 +782,16 @@ msgstr "సర్వర్ తప్పు <em>(500)</em>"
msgid ""
"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."
msgstr "తప్పు రిగిండి . దానిని నిర్వాహనాధికారులు కి ఈ మెయిల్ చేయబడ్డడి,మీ ఓపిక కి ధన్యవాదములు"
msgstr "తప్పు రిగిండి . దానిని నిర్వాహనాధికారులు కి ఈ మెయిల్ చేయబడ్డడి,మీ ఓపిక కి ధన్యవాదములు"
#: contrib/admin/templates/admin/404.html:4
#: contrib/admin/templates/admin/404.html:8
msgid "Page not found"
msgstr "పేి దొరకలేదు"
msgstr "పేి దొరకలేదు"
#: contrib/admin/templates/admin/404.html:10
msgid "We're sorry, but the requested page could not be found."
msgstr "క్షమించండి మీరు కోరిన పేి దొరకలేడు"
msgstr "క్షమించండి మీరు కోరిన పేి దొరకలేడు"
#: contrib/admin/templates/admin/index.html:17
#, python-format
@ -801,12 +801,12 @@ msgstr "మొడల్ లు %(name)లో దొరికే అప్ప్
#: contrib/admin/templates/admin/index.html:18
#, python-format
msgid "%(name)s"
msgstr ""
msgstr "%(name)లు"
#: contrib/admin/templates/admin/index.html:28
#: contrib/admin/templates/admin/change_form.html:15
msgid "Add"
msgstr "త చేయి"
msgstr "త చేయి"
#: contrib/admin/templates/admin/index.html:34
msgid "Change"
@ -831,7 +831,7 @@ msgstr "ఏమి దొరకలేదు"
#: contrib/admin/templates/admin/change_list.html:11
#, python-format
msgid "Add %(name)s"
msgstr "%(name)లు త చేయు"
msgstr "%(name)లు త చేయు"
#: contrib/admin/templates/admin/login.html:22
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
msgid "Username"
msgstr "యూర్ పేరు"
msgstr "యూర్ పేరు"
#: contrib/admin/templates/admin/auth/user/add_form.html:18
msgid "Password"
@ -967,7 +967,7 @@ msgstr "పాస్ వర్డ్ మార్పు"
#: contrib/admin/templates/registration/password_change_done.html:6
#: contrib/admin/templates/registration/password_change_done.html:10
msgid "Password change successful"
msgstr "పాస్ వర్డ్ మార్పు యప్రదమైండి "
msgstr "పాస్ వర్డ్ మార్పు యప్రదమైండి "
#: contrib/admin/templates/registration/password_change_done.html:12
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:10
msgid "Password reset successful"
msgstr "పాస్ వర్డ్ రీసెట్ యప్రదమైండి"
msgstr "పాస్ వర్డ్ రీసెట్ యప్రదమైండి"
#: contrib/admin/templates/registration/password_reset_done.html:12
msgid ""
@ -1051,11 +1051,11 @@ msgstr "మీ కొత్త పాస్ వర్డ్ : %(new_password)s
#: contrib/admin/templates/registration/password_reset_email.html:7
msgid "Feel free to change this password by going to this page:"
msgstr "నిస్సందేహము గా ఈ పేి క్ కి వెళ్ళి పాస్ వర్డ్ మార్చుకోండి "
msgstr "నిస్సందేహము గా ఈ పేి క్ కి వెళ్ళి పాస్ వర్డ్ మార్చుకోండి "
#: contrib/admin/templates/registration/password_reset_email.html:11
msgid "Your username, in case you've forgotten:"
msgstr "మీ యూర్ పేరు, ఒక వేళ మర్చిపోయి ఉంటే "
msgstr "మీ యూర్ పేరు, ఒక వేళ మర్చిపోయి ఉంటే "
#: contrib/admin/templates/registration/password_reset_email.html:13
msgid "Thanks for using our site!"
@ -1103,19 +1103,19 @@ msgstr "వస్తువు ఇడి చూడండి"
msgid ""
"Shows the content-type and unique ID for pages that represent a single "
"object."
msgstr "వస్తువు"
msgstr ""
#: contrib/admin/templates/admin_doc/bookmarklets.html:25
msgid "Edit this object (current window)"
msgstr "వస్తువు"
msgstr "వస్తువు ని మార్చండి (ప్రస్తుత విండొ)"
#: contrib/admin/templates/admin_doc/bookmarklets.html:26
msgid "Jumps to the admin page for pages that represent a single object."
msgstr "వస్తువు"
msgstr ""
#: contrib/admin/templates/admin_doc/bookmarklets.html:28
msgid "Edit this object (new window)"
msgstr "వస్తువు"
msgstr "వస్తువు ని మార్చండి(కొత్త విండొ) "
#: contrib/admin/templates/admin_doc/bookmarklets.html:29
msgid "As above, but opens the admin page in a new window."
@ -1197,7 +1197,7 @@ msgstr "నమొదు చేయటము అవసరం"
#: contrib/flatpages/models.py:14
msgid "If this is checked, only logged-in users will be able to view the page."
msgstr "ఇది చెక్ చేసి ఉంటే కేవలం లాగ్గడ్ ఇన్ యూఙర్లు పేఙి చూడలేస్తారు"
msgstr "ఇది చెక్ చేసి ఉంటే కేవలం లాగ్గడ్ ఇన్ యూజర్లు పేజి చూడలేస్తారు"
#: contrib/flatpages/models.py:18
msgid "flat page"
@ -1237,7 +1237,7 @@ msgstr "గుంపులు"
#: contrib/auth/models.py:90
msgid "username"
msgstr "యూర్ పేరు"
msgstr "యూర్ పేరు"
#: contrib/auth/models.py:90
msgid ""
@ -1309,15 +1309,15 @@ msgstr ""
#: contrib/auth/models.py:102
msgid "user permissions"
msgstr "యూర్ అనుమతులు"
msgstr "యూర్ అనుమతులు"
#: contrib/auth/models.py:105
msgid "user"
msgstr "యూర్"
msgstr "యూర్"
#: contrib/auth/models.py:106
msgid "users"
msgstr "యూర్లు"
msgstr "యూర్లు"
#: contrib/auth/models.py:111
msgid "Personal info"
@ -1427,7 +1427,7 @@ msgstr "ఆదివారము"
#: utils/dates.py:14
msgid "January"
msgstr "ాన్వరి "
msgstr "ాన్వరి "
#: utils/dates.py:14
msgid "February"
@ -1447,11 +1447,11 @@ msgstr "మే"
#: utils/dates.py:14 utils/dates.py:27
msgid "June"
msgstr "ూను"
msgstr "ూను"
#: utils/dates.py:15 utils/dates.py:27
msgid "July"
msgstr "ులై"
msgstr "ులై"
#: utils/dates.py:15
msgid "August"
@ -1475,7 +1475,7 @@ msgstr "డిసెంబర్"
#: utils/dates.py:19
msgid "jan"
msgstr "ాన్"
msgstr "ాన్"
#: utils/dates.py:19
msgid "feb"
@ -1495,11 +1495,11 @@ msgstr "మే"
#: utils/dates.py:19
msgid "jun"
msgstr "ూన్"
msgstr "ూన్"
#: utils/dates.py:20
msgid "jul"
msgstr "ుల్"
msgstr "ుల్"
#: utils/dates.py:20
msgid "aug"
@ -1523,7 +1523,7 @@ msgstr "డిస్"
#: utils/dates.py:27
msgid "Jan."
msgstr "ాన్"
msgstr "ాన్"
#: utils/dates.py:27
msgid "Feb."
@ -1570,8 +1570,8 @@ msgstr[1] "వారాలు"
#: utils/timesince.py:15
msgid "day"
msgid_plural "days"
msgstr[0] "రోు"
msgstr[1] "రోులు"
msgstr[0] "రోు"
msgstr[1] "రోులు"
#: utils/timesince.py:16
msgid "hour"
@ -1615,7 +1615,7 @@ msgstr "బెంగాలి"
#: conf/global_settings.py:41
msgid "Czech"
msgstr "క్ెఖ్"
msgstr "క్ెఖ్"
#: conf/global_settings.py:42
msgid "Welsh"
@ -1627,7 +1627,7 @@ msgstr "డానిశ్"
#: conf/global_settings.py:44
msgid "German"
msgstr "ెర్మన్"
msgstr "ెర్మన్"
#: conf/global_settings.py:45
msgid "Greek"
@ -1643,7 +1643,7 @@ msgstr "స్పానిష్"
#: conf/global_settings.py:48
msgid "Argentinean Spanish"
msgstr "అర్ంటీనా స్పానిష్"
msgstr "అర్ంటీనా స్పానిష్"
#: conf/global_settings.py:49
msgid "Finnish"
@ -1675,7 +1675,7 @@ msgstr "ఇటాలియవ్"
#: conf/global_settings.py:56
msgid "Japanese"
msgstr "పనీస్"
msgstr "పనీస్"
#: conf/global_settings.py:57
msgid "Dutch"
@ -1683,11 +1683,11 @@ msgstr "డట్చ్"
#: conf/global_settings.py:58
msgid "Norwegian"
msgstr "నార్వీియన్"
msgstr "నార్వీియన్"
#: conf/global_settings.py:59
msgid "Brazilian"
msgstr "బ్రీలియన్"
msgstr "బ్రీలియన్"
#: conf/global_settings.py:60
msgid "Romanian"
@ -1865,7 +1865,7 @@ msgstr ""
#: core/validators.py:242
msgid "Enter a valid U.S. state abbreviation."
msgstr "దయచేసి సరైన అగ్ర రా్య సంక్షేపము చేసిన రాష్ట్రము పేరు ఇవ్వండి"
msgstr "దయచేసి సరైన అగ్ర రా్య సంక్షేపము చేసిన రాష్ట్రము పేరు ఇవ్వండి"
#: core/validators.py:256
#, python-format
@ -2004,12 +2004,12 @@ msgstr ""
#: views/generic/create_update.py:43
#, python-format
msgid "The %(verbose_name)s was created successfully."
msgstr "%(verbose_name)లు యప్రదంగా తయారయింది"
msgstr "%(verbose_name)లు యప్రదంగా తయారయింది"
#: views/generic/create_update.py:117
#, python-format
msgid "The %(verbose_name)s was updated successfully."
msgstr "%(verbose_name)లు యప్రదంగా @@"
msgstr "%(verbose_name)లు యప్రదంగా @@"
#: views/generic/create_update.py:184
#, python-format

View File

@ -1,19 +1,25 @@
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'
handler500 = 'django.views.defaults.server_error'
include = lambda urlconf_module: [urlconf_module]
def patterns(prefix, *tuples):
def patterns(prefix, *args):
pattern_list = []
for t in tuples:
regex, view_or_include = t[:2]
default_kwargs = t[2:]
if type(view_or_include) == list:
pattern_list.append(RegexURLResolver(regex, view_or_include[0], *default_kwargs))
for t in args:
if isinstance(t, (list, tuple)):
pattern_list.append(url(prefix=prefix, *t))
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
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)

View File

@ -209,7 +209,7 @@ class FreeComment(models.Model):
class KarmaScoreManager(models.Manager):
def vote(self, user_id, comment_id, score):
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:
karma = self.model(None, user_id=user_id, comment_id=comment_id, score=score, scored_date=datetime.datetime.now())
karma.save()

View 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'),
)

View 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.newforms.util 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=u'Informe um código postal no formato 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(u'Números de telefone devem estar no formato XX-XXXX-XXXX.')
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)

View 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")
)

View 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.'))

View File

@ -0,0 +1,32 @@
"""
IT-specific Form helpers
"""
from django.newforms import ValidationError
from django.newforms.fields import Field, RegexField, Select, EMPTY_VALUES
from django.newforms.util import smart_unicode
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)

View 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'LAcquila'),
('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'),
)

View 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 dAosta'),
('VEN', 'Veneto'),
)

View 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

View 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')
)

View File

View 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)

View 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)

View File

@ -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/
@ -18,15 +18,16 @@ __version__ = "0.1"
__all__ = ["runfastcgi"]
FASTCGI_HELP = r"""runfcgi:
Run this project as a fastcgi application. To do this, the
flup package from http://www.saddi.com/software/flup/ is
required.
Run this project as a fastcgi (or some other protocol supported
by flup) application. To do this, the flup package from
http://www.saddi.com/software/flup/ is required.
Usage:
django-admin.py runfcgi --settings=yourproject.settings [fcgi settings]
manage.py runfcgi [fcgi settings]
Optional Fcgi settings: (setting=value)
protocol=PROTOCOL fcgi, scgi, ajp, ... (default fcgi)
host=HOSTNAME hostname to listen on..
port=PORTNUM port to listen on.
socket=FILE UNIX socket to listen on.
@ -45,8 +46,8 @@ Examples:
(for webservers which spawn your processes for you)
$ manage.py runfcgi method=threaded
Run a fastcgi server on a TCP host/port
$ manage.py runfcgi method=prefork host=127.0.0.1 port=8025
Run a scgi server on a TCP host/port
$ 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)
$ manage.py runfcgi method=prefork socket=/tmp/fcgi.sock
@ -58,6 +59,7 @@ Examples:
"""
FASTCGI_OPTIONS = {
'protocol': 'fcgi',
'host': None,
'port': 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."
return False
flup_module = 'server.' + options['protocol']
if options['method'] in ('prefork', 'fork'):
from flup.server.fcgi_fork import WSGIServer
wsgi_opts = {
'maxSpare': int(options["maxspare"]),
'minSpare': int(options["minspare"]),
'maxChildren': int(options["maxchildren"]),
'maxRequests': int(options["maxrequests"]),
}
flup_module += '_fork'
elif options['method'] in ('thread', 'threaded'):
from flup.server.fcgi import WSGIServer
wsgi_opts = {
'maxSpare': int(options["maxspare"]),
'minSpare': int(options["minspare"]),
@ -120,6 +123,12 @@ def runfastcgi(argset=[], **kwargs):
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
from django.core.handlers.wsgi import WSGIHandler

View File

@ -88,7 +88,7 @@ class MatchChecker(object):
return str(value) # TODO: Unicode?
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.
# 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
@ -100,6 +100,7 @@ class RegexURLPattern(object):
self._callback = None
self._callback_str = callback
self.default_args = default_args or {}
self.name = name
def resolve(self, path):
match = self.regex.search(path)
@ -205,6 +206,7 @@ class RegexURLResolver(object):
try:
lookup_view = getattr(__import__(mod_name, {}, {}, ['']), func_name)
except (ImportError, AttributeError):
if func_name != '':
raise NoReverseMatch
for pattern in self.urlconf_module.urlpatterns:
if isinstance(pattern, RegexURLResolver):
@ -212,7 +214,7 @@ class RegexURLResolver(object):
return pattern.reverse_helper(lookup_view, *args, **kwargs)
except NoReverseMatch:
continue
elif pattern.callback == lookup_view:
elif pattern.callback == lookup_view or pattern.name == lookup_view:
try:
return pattern.reverse_helper(*args, **kwargs)
except NoReverseMatch:

View File

@ -22,7 +22,12 @@ class ModelBase(type):
"Metaclass for all models"
def __new__(cls, name, bases, attrs):
# 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)
# Create the class.

View File

@ -155,6 +155,9 @@ def parse_cookie(cookie):
class HttpResponse(object):
"A basic HTTP response, with content and dictionary-accessed headers"
status_code = 200
def __init__(self, content='', mimetype=None):
from django.conf import settings
self._charset = settings.DEFAULT_CHARSET
@ -168,7 +171,6 @@ class HttpResponse(object):
self._is_string = True
self.headers = {'Content-Type': mimetype}
self.cookies = SimpleCookie()
self.status_code = 200
def __str__(self):
"Full HTTP message, including headers"
@ -254,47 +256,49 @@ class HttpResponse(object):
return sum([len(chunk) for chunk in self._container])
class HttpResponseRedirect(HttpResponse):
status_code = 302
def __init__(self, redirect_to):
HttpResponse.__init__(self)
self['Location'] = quote(redirect_to, safe=RESERVED_CHARS)
self.status_code = 302
class HttpResponsePermanentRedirect(HttpResponse):
status_code = 301
def __init__(self, redirect_to):
HttpResponse.__init__(self)
self['Location'] = quote(redirect_to, safe=RESERVED_CHARS)
self.status_code = 301
class HttpResponseNotModified(HttpResponse):
def __init__(self):
HttpResponse.__init__(self)
self.status_code = 304
status_code = 304
class HttpResponseBadRequest(HttpResponse):
status_code = 400
class HttpResponseNotFound(HttpResponse):
def __init__(self, *args, **kwargs):
HttpResponse.__init__(self, *args, **kwargs)
self.status_code = 404
status_code = 404
class HttpResponseForbidden(HttpResponse):
def __init__(self, *args, **kwargs):
HttpResponse.__init__(self, *args, **kwargs)
self.status_code = 403
status_code = 403
class HttpResponseNotAllowed(HttpResponse):
status_code = 405
def __init__(self, permitted_methods):
HttpResponse.__init__(self)
self['Allow'] = ', '.join(permitted_methods)
self.status_code = 405
class HttpResponseGone(HttpResponse):
status_code = 410
def __init__(self, *args, **kwargs):
HttpResponse.__init__(self, *args, **kwargs)
self.status_code = 410
class HttpResponseServerError(HttpResponse):
status_code = 500
def __init__(self, *args, **kwargs):
HttpResponse.__init__(self, *args, **kwargs)
self.status_code = 500
def get_host(request):
"Gets the HTTP host from the environment or request headers."

View File

@ -38,15 +38,16 @@ class Field(object):
def __init__(self, required=True, widget=None, label=None, initial=None, help_text=None):
# required -- Boolean that specifies whether the field is required.
# True by default.
# widget -- A Widget class, or instance of a Widget class, that should be
# used for this Field when displaying it. Each Field has a default
# Widget that it'll use if you don't specify this. In most cases,
# the default widget is TextInput.
# label -- A verbose name for this field, for use in displaying this field in
# a form. By default, Django will use a "pretty" version of the form
# field name, if the Field is part of a Form.
# initial -- A value to use in this Field's initial display. This value is
# *not* used as a fallback if data isn't given.
# widget -- A Widget class, or instance of a Widget class, that should
# be used for this Field when displaying it. Each Field has a
# default Widget that it'll use if you don't specify this. In
# most cases, the default widget is TextInput.
# label -- A verbose name for this field, for use in displaying this
# field in a form. By default, Django will use a "pretty"
# version of the form field name, if the Field is part of a
# Form.
# 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.
if label is not None:
label = smart_unicode(label)

View File

@ -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)
clean_data = form.clean_data
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
setattr(instance, f.name, clean_data[f.name])
if commit:
instance.save()
for f in opts.many_to_many:
if f.name in clean_data:
setattr(instance, f.attname, clean_data[f.name])
# 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

View File

@ -1,11 +1,20 @@
from django.conf import settings
from django.utils.html import escape
from django.utils.functional import Promise, lazy
# 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.
flatatt = lambda attrs: u''.join([u' %s="%s"' % (k, escape(v)) for k, v in attrs.items()])
def smart_unicode(s):
if isinstance(s, Promise):
# The input is something from gettext_lazy or similar. We don't want to
# translate it until render time, so defer the conversion.
return smart_unicode_lazy(s)
else:
return smart_unicode_immediate(s)
def smart_unicode_immediate(s):
if not isinstance(s, basestring):
if hasattr(s, '__unicode__'):
s = unicode(s)
@ -15,6 +24,8 @@ def smart_unicode(s):
s = unicode(s, settings.DEFAULT_CHARSET)
return s
smart_unicode_lazy = lazy(smart_unicode_immediate, unicode)
class StrAndUnicode(object):
"""
A class whose __str__ returns its __unicode__ as a bytestring

View File

@ -24,7 +24,10 @@ class Widget(object):
is_hidden = False # Determines whether this corresponds to an <input type="hidden">.
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):
"""

View File

@ -923,7 +923,8 @@ class FilePathField(SelectField):
for root, dirs, files in os.walk(path):
for f in files:
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:
try:
for f in os.listdir(path):

View File

@ -280,24 +280,6 @@ class LoadNode(Node):
def render(self, context):
return ''
class LoremNode(Node):
def __init__(self, count, method, common):
self.count, self.method, self.common = count, method, common
def render(self, context):
from django.utils.lorem_ipsum import words, paragraphs
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)
class NowNode(Node):
def __init__(self, format_string):
self.format_string = format_string
@ -786,52 +768,6 @@ def load(parser, token):
return LoadNode()
load = register.tag(load)
#@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)
#@register.tag
def now(parser, token):
"""
@ -916,7 +852,7 @@ regroup = register.tag(regroup)
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.
Example usage::
@ -929,7 +865,7 @@ def spaceless(parser, token):
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
this example, the space around ``Hello`` won't be stripped::

View File

@ -39,8 +39,8 @@ def strip_tags(value):
return re.sub(r'<[^>]*?>', '', value)
def strip_spaces_between_tags(value):
"Returns the given HTML with spaces between tags normalized to a single space"
return re.sub(r'>\s+<', '> <', value)
"Returns the given HTML with spaces between tags removed"
return re.sub(r'>\s+<', '><', value)
def strip_entities(value):
"Returns the given HTML with all entities (&something;) stripped"

View File

@ -191,14 +191,15 @@ def smart_split(text):
Supports both single and double quotes, and supports escaping quotes with
backslashes. In the output, strings will keep their initial and trailing
quote marks.
>>> list(smart_split('This is "a person\'s" test.'))
['This', 'is', '"a person\'s"', 'test.']
"""
for bit in smart_split_re.finditer(text):
bit = bit.group(0)
if bit[0] == '"':
if bit[0] == '"' and bit[-1] == '"':
yield '"' + bit[1:-1].replace('\\"', '"').replace('\\\\', '\\') + '"'
elif bit[0] == "'":
elif bit[0] == "'" and bit[-1] == "'":
yield "'" + bit[1:-1].replace("\\'", "'").replace("\\\\", "\\") + "'"
else:
yield bit

View File

@ -1,8 +1,94 @@
from django.conf import settings
"""
Internationalization support.
"""
from django.utils.functional import lazy
if settings.USE_I18N:
from trans_real import *
else:
from trans_null import *
__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']
# 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
if settings.USE_I18N:
import trans_real as trans
else:
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()
del settings

View File

@ -3,7 +3,6 @@
import os, re, sys
import gettext as gettext_module
from cStringIO import StringIO
from django.utils.functional import lazy
try:
import threading
@ -277,9 +276,6 @@ def ngettext(singular, plural, number):
_default = translation(settings.LANGUAGE_CODE)
return _default.ngettext(singular, plural, number)
gettext_lazy = lazy(gettext, str)
ngettext_lazy = lazy(ngettext, str)
def check_for_language(lang_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])
string_concat = lazy(string_concat, str)

View File

@ -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,
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
setup is FastCGI. See `How to use Django with FastCGI`_ for full information.
talk to any WSGI-enabled server. Other non-mod_python deployment setups are
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.
@ -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.
.. _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
How do I install mod_python on Windows?

View File

@ -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
`mod_python`_, many people use shared hosting, on which FastCGI is the only
viable option. In some setups, FastCGI also allows better security -- and,
possibly, better performance -- than mod_python.
`mod_python`_, many people use shared hosting, on which protocols such as
FastCGI, SCGI or AJP are the only viable options. In some setups, these protocols
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
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
list of all the available options.
You'll need to specify either a ``socket`` or both ``host`` and ``port``. Then,
when you set up your Web server, you'll just need to point it at the host/port
You'll need to specify either a ``socket``, ``protocol`` or both ``host`` and ``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.
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
--------

View File

@ -517,10 +517,10 @@ to put punctuation at the end of your validation messages.
When are validators called?
---------------------------
After a form has been submitted, Django first checks to see that all the
required fields are present and non-empty. For each field that passes that
test *and if the form submission contained data* for that field, all the
validators for that field are called in turn. The emphasized portion in the
After a form has been submitted, Django validates each field in turn. First,
if the field is required, Django checks that it is present and non-empty. Then,
if that test passes *and the form submission contained data* for that field, all
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
contains no data -- which is normal HTML behavior), the validators are not
run against the field.

View File

@ -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
``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``
------------------------------------------------

View File

@ -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.
You can further decouple your models from the URLconf using the ``permalink``
decorator. This decorator is passed the view function and any parameters you
would use for accessing this instance directly. Django then works out the
correct full URL path using the URLconf. For example::
decorator. This decorator is passed the view function, a list of positional
parameters and (optionally) a dictionary of named parameters. Django then
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
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)
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
to display it, without repeating the URL information anywhere. You can still
use the ``get_absolute_url`` method in templates, as before.

View File

@ -13,14 +13,15 @@ other server arrangements.
Django requires Apache 2.x and mod_python 3.x, and you should use Apache's
`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/
.. _mod_python: http://www.modpython.org/
.. _mod_perl: http://perl.apache.org/
.. _prefork MPM: http://httpd.apache.org/docs/2.2/mod/prefork.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
===================
@ -37,7 +38,8 @@ Then edit your ``httpd.conf`` file and add the following::
PythonDebug On
</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
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"
.. 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.
See the `mod_python documentation`_ for a full list of options.

View File

@ -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
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``
Acts just like ``HttpResponse`` but uses a 404 status code.

View File

@ -625,31 +625,6 @@ Load a custom template tag set.
See `Custom tag and filter libraries`_ for more information.
lorem
~~~~~
Display random latin text useful for providing sample data in templates.
Usage format: ``{% lorem [count] [method] [random] %}``
=========== =============================================================
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.
now
~~~
@ -782,7 +757,7 @@ i.e.::
spaceless
~~~~~~~~~
Normalizes whitespace between HTML tags to a single space. This includes tab
Removes whitespace between HTML tags. This includes tab
characters and newlines.
Example usage::
@ -795,9 +770,9 @@ Example usage::
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::
{% spaceless %}

View File

@ -185,10 +185,25 @@ The first argument to ``patterns()`` is a string ``prefix``. See
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
_`Passing extra options to view functions` below.)
...where ``optional dictionary`` and ``optional name`` are optional. (See
`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
----------
@ -479,3 +494,44 @@ The style you use is up to you.
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.
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
View 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.

View File

@ -97,6 +97,16 @@ class SelfClashM2M(models.Model):
m2m_3 = 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.
invalid_models.fielderrors: "floatfield": FloatFields require a "decimal_places" attribute.
invalid_models.fielderrors: "floatfield": FloatFields require a "max_digits" attribute.

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,29 @@
# -*- 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()
"""

View File

@ -1,5 +1,8 @@
# -*- coding: utf-8 -*-
r"""
from localflavor import localflavor_tests
from regressions import regression_tests
form_tests = r"""
>>> from django.newforms import *
>>> import datetime
>>> import re
@ -3268,617 +3271,6 @@ True
<option value="2016">2016</option>
</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&#39;Or</option>
<option value="22">22 - Cotes-d&#39;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&#39;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 #
#################################
@ -3903,6 +3295,12 @@ u'1'
u'foo'
"""
__test__ = {
'form_tests': form_tests,
'localflavor': localflavor_tests,
'regressions': regression_tests,
}
if __name__ == "__main__":
import doctest
doctest.testmod()

View File

@ -27,8 +27,10 @@ should've produced %s""" % (method, rendered, result_list[index]))
self.humanize_tester(test_list, result_list, 'ordinal')
def test_intcomma(self):
test_list = ('100','1000','10123','10311','1000000')
result_list = ('100', '1,000', '10,123', '10,311', '1,000,000')
test_list = (100, 1000, 10123, 10311, 1000000, 1234567.25,
'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')

View File

@ -522,8 +522,8 @@ class Templates(unittest.TestCase):
### I18N ##################################################################
# {% spaceless %} tag
'spaceless01': ("{% spaceless %} <b> <i> text </i> </b> {% endspaceless %}", {}, "<b> <i> text </i> </b>"),
'spaceless02': ("{% spaceless %} <b> \n <i> text </i> \n </b> {% endspaceless %}", {}, "<b> <i> text </i> </b>"),
'spaceless01': ("{% spaceless %} <b> <i> text </i> </b> {% endspaceless %}", {}, "<b><i> text </i></b>"),
'spaceless02': ("{% spaceless %} <b> \n <i> text </i> \n </b> {% endspaceless %}", {}, "<b><i> text </i></b>"),
'spaceless03': ("{% spaceless %}<b><i>text</i></b>{% endspaceless %}", {}, "<b><i>text</i></b>"),
# simple translation of a string delimited by '
@ -654,11 +654,6 @@ class Templates(unittest.TestCase):
'with01': ('{% with dict.key as key %}{{ key }}{% endwith %}', {'dict': {'key':50}}, '50'),
'with02': ('{{ key }}{% with dict.key as key %}{{ key }}-{{ dict.key }}-{{ key }}{% endwith %}{{ key }}', {'dict': {'key':50}}, ('50-50-50', 'INVALID50-50-50INVALID')),
### LOREM TAG ######################################################
'lorem01': ('{% lorem %}', {}, '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.'),
'lorem02': ('{% lorem p %}', {}, '<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.</p>'),
'lorem03': ('{% lorem 6 w %}', {}, 'lorem ipsum dolor sit amet consectetur'),
### NOW TAG ########################################################
# Simple case
'now01' : ('{% now "j n Y"%}', {}, str(datetime.now().day) + ' ' + str(datetime.now().month) + ' ' + str(datetime.now().year)),
@ -697,11 +692,12 @@ class Templates(unittest.TestCase):
'url01' : ('{% url regressiontests.templates.views.client client.id %}', {'client': {'id': 1}}, '/url_tag/client/1/'),
'url02' : ('{% url regressiontests.templates.views.client_action client.id,action="update" %}', {'client': {'id': 1}}, '/url_tag/client/1/update/'),
'url03' : ('{% url regressiontests.templates.views.index %}', {}, '/url_tag/'),
'url04' : ('{% url named-client client.id %}', {'client': {'id': 1}}, '/url_tag/named-client/1/'),
# Failures
'url04' : ('{% url %}', {}, template.TemplateSyntaxError),
'url05' : ('{% url no_such_view %}', {}, ''),
'url06' : ('{% url regressiontests.templates.views.client no_such_param="value" %}', {}, ''),
'url-fail01' : ('{% url %}', {}, template.TemplateSyntaxError),
'url-fail02' : ('{% url no_such_view %}', {}, ''),
'url-fail03' : ('{% url regressiontests.templates.views.client no_such_param="value" %}', {}, ''),
}
# Register our custom template loader.

View File

@ -7,4 +7,5 @@ urlpatterns = patterns('',
(r'^$', views.index),
(r'^client/(\d+)/$', views.client),
(r'^client/(\d+)/(?P<action>[^/]+)/$', views.client_action),
url(r'^named-client/(\d+)/$', views.client, name="named-client"),
)

View File

View File

View File

@ -0,0 +1,17 @@
"""
# Tests for stuff in django.utils.text.
>>> from django.utils.text import *
### smart_split ###########################################################
>>> list(smart_split(r'''This is "a person" test.'''))
['This', 'is', '"a person"', 'test.']
>>> print list(smart_split(r'''This is "a person's" test.'''))[2]
"a person's"
>>> print list(smart_split(r'''This is "a person\\"s" test.'''))[2]
"a person"s"
>>> list(smart_split('''"a 'one'''))
['"a', "'one"]
>>> print list(smart_split(r'''all friends' tests'''))[1]
friends'
"""