Skip to content
Browse files

newforms-admin: Merged from trunk up to [7120].

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7121 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent daa467d commit 7c1242a7a3a62bc63715bc47400827d4cf3c5e05 @jkocherhans jkocherhans committed
Showing with 22,763 additions and 10,164 deletions.
  1. +7 −2 AUTHORS
  2. +2 −1 django/conf/global_settings.py
  3. BIN django/conf/locale/ca/LC_MESSAGES/django.mo
  4. +357 −512 django/conf/locale/ca/LC_MESSAGES/django.po
  5. BIN django/conf/locale/ca/LC_MESSAGES/djangojs.mo
  6. +5 −7 django/conf/locale/ca/LC_MESSAGES/djangojs.po
  7. BIN django/conf/locale/cy/LC_MESSAGES/django.mo
  8. +1 −0 django/conf/locale/cy/LC_MESSAGES/django.po
  9. BIN django/conf/locale/de/LC_MESSAGES/django.mo
  10. +28 −0 django/conf/locale/de/LC_MESSAGES/django.po
  11. BIN django/conf/locale/es_AR/LC_MESSAGES/django.mo
  12. +1,063 −265 django/conf/locale/es_AR/LC_MESSAGES/django.po
  13. BIN django/conf/locale/eu/LC_MESSAGES/django.mo
  14. +4,248 −0 django/conf/locale/eu/LC_MESSAGES/django.po
  15. BIN django/conf/locale/eu/LC_MESSAGES/djangojs.mo
  16. +117 −0 django/conf/locale/eu/LC_MESSAGES/djangojs.po
  17. BIN django/conf/locale/fa/LC_MESSAGES/django.mo
  18. +2,990 −1,608 django/conf/locale/fa/LC_MESSAGES/django.po
  19. BIN django/conf/locale/ga/LC_MESSAGES/django.mo
  20. +2,464 −1,703 django/conf/locale/ga/LC_MESSAGES/django.po
  21. BIN django/conf/locale/ga/LC_MESSAGES/djangojs.mo
  22. +25 −25 django/conf/locale/ga/LC_MESSAGES/djangojs.po
  23. BIN django/conf/locale/is/LC_MESSAGES/django.mo
  24. +3,638 −1,414 django/conf/locale/is/LC_MESSAGES/django.po
  25. BIN django/conf/locale/it/LC_MESSAGES/django.mo
  26. +3,209 −2,270 django/conf/locale/it/LC_MESSAGES/django.po
  27. BIN django/conf/locale/kn/LC_MESSAGES/django.mo
  28. +3 −0 django/conf/locale/kn/LC_MESSAGES/django.po
  29. BIN django/conf/locale/pl/LC_MESSAGES/django.mo
  30. +667 −178 django/conf/locale/pl/LC_MESSAGES/django.po
  31. BIN django/conf/locale/pt/LC_MESSAGES/django.mo
  32. +3 −0 django/conf/locale/pt/LC_MESSAGES/django.po
  33. BIN django/conf/locale/sv/LC_MESSAGES/django.mo
  34. +3,343 −1,958 django/conf/locale/sv/LC_MESSAGES/django.po
  35. BIN django/conf/locale/sv/LC_MESSAGES/djangojs.mo
  36. +10 −11 django/conf/locale/sv/LC_MESSAGES/djangojs.po
  37. +1 −1 django/conf/project_template/settings.py
  38. +1 −1 django/conf/urls/shortcut.py
  39. +1 −1 django/contrib/admin/urls.py
  40. +16 −6 django/contrib/comments/models.py
  41. +1 −1 django/contrib/databrowse/datastructures.py
  42. +3 −3 django/contrib/localflavor/ar/forms.py
  43. +1 −1 django/contrib/localflavor/uk/uk_regions.py
  44. +3 −2 django/contrib/syndication/feeds.py
  45. +4 −4 django/core/handlers/base.py
  46. +3 −3 django/core/management/commands/loaddata.py
  47. +1 −1 django/core/management/commands/sqlall.py
  48. +39 −36 django/db/models/base.py
  49. +6 −6 django/middleware/gzip.py
  50. +2 −0 django/newforms/fields.py
  51. +27 −10 django/newforms/forms.py
  52. +29 −46 django/newforms/models.py
  53. +1 −1 django/newforms/widgets.py
  54. +16 −0 django/template/__init__.py
  55. +1 −1 django/template/defaultfilters.py
  56. +14 −4 django/template/loader_tags.py
  57. +2 −2 django/test/client.py
  58. +9 −2 django/test/testcases.py
  59. +5 −4 django/utils/datastructures.py
  60. +1 −1 django/utils/encoding.py
  61. +1 −1 django/utils/feedgenerator.py
  62. +14 −9 django/utils/html.py
  63. +13 −8 django/utils/translation/trans_real.py
  64. +13 −5 django/views/debug.py
  65. +1 −1 docs/api_stability.txt
  66. +2 −2 docs/contenttypes.txt
  67. +1 −1 docs/distributions.txt
  68. +3 −3 docs/django-admin.txt
  69. +8 −0 docs/i18n.txt
  70. +1 −1 docs/install.txt
  71. +16 −3 docs/localflavor.txt
  72. +5 −5 docs/model-api.txt
  73. +49 −4 docs/modelforms.txt
  74. +7 −2 docs/request_response.txt
  75. +14 −3 docs/shortcuts.txt
  76. +22 −0 docs/url_dispatch.txt
  77. +112 −15 tests/modeltests/model_forms/models.py
  78. BIN tests/modeltests/model_forms/test.png
  79. +2 −2 tests/modeltests/ordering/models.py
  80. +33 −2 tests/modeltests/signals/models.py
  81. +13 −0 tests/regressiontests/datastructures/tests.py
  82. +56 −0 tests/regressiontests/i18n/misc.py
  83. +9 −5 tests/regressiontests/templates/filters.py
  84. +1 −1 tests/regressiontests/templates/tests.py
View
9 AUTHORS
@@ -45,6 +45,8 @@ answer newbie questions, and generally made Django that much better:
Marty Alchin <gulopine@gamemusic.org>
Daniel Alves Barbosa de Oliveira Vaz <danielvaz@gmail.com>
AgarFu <heaven@croasanaso.sytes.net>
+ Dagur Páll Ammendrup <dagurp@gmail.com>
+ Collin Anderson <cmawebsite@gmail.com>
Andreas
andy@jadedplanet.net
Fabrice Aneche <akh@nobugware.com>
@@ -52,7 +54,7 @@ answer newbie questions, and generally made Django that much better:
Florian Apolloner
arien <regexbot@gmail.com>
David Ascher <http://ascher.ca/>
- david@kazserve.org
+ Jökull Sólberg Auðunsson <jokullsolberg@gmail.com>
Arthur <avandorp@gmail.com>
axiak@mit.edu
Jiri Barton
@@ -100,6 +102,7 @@ answer newbie questions, and generally made Django that much better:
Dirk Datzert <dummy@habmalnefrage.de>
Jonathan Daugherty (cygnus) <http://www.cprogrammer.org/>
dave@thebarproject.com
+ david@kazserve.org
Jason Davies (Esaj) <http://www.jasondavies.com/>
Alex Dedul
deric@monowerks.com
@@ -166,6 +169,7 @@ answer newbie questions, and generally made Django that much better:
Rob Hudson <http://rob.cogit8.org/>
Jason Huggins <http://www.jrandolph.com/blog/>
Hyun Mi Ae
+ Ibon <ibonso@gmail.com>
Tom Insam
Baurzhan Ismagulov <ibr@radix50.net>
james_027@yahoo.com
@@ -233,7 +237,7 @@ answer newbie questions, and generally made Django that much better:
Christian Metts
michael.mcewan@gmail.com
michal@plovarna.cz
- mikko@sorl.net
+ Mikko Hellsing <mikko@sorl.net>
Slawek Mikula <slawek dot mikula at gmail dot com>
mitakummaa@gmail.com
mmarshall
@@ -307,6 +311,7 @@ answer newbie questions, and generally made Django that much better:
Don Spaulding <donspauldingii@gmail.com>
Bjørn Stabell <bjorn@exoweb.net>
Georgi Stanojevski <glisha@gmail.com>
+ starrynight <cmorgh@gmail.com>
Vasiliy Stavenko <stavenko@gmail.com>
Thomas Steinacher <http://www.eggdrop.ch/>
Johan C. Stöver <johan@nilling.nl>
View
3 django/conf/global_settings.py
@@ -47,7 +47,8 @@
('el', gettext_noop('Greek')),
('en', gettext_noop('English')),
('es', gettext_noop('Spanish')),
- ('es_AR', gettext_noop('Argentinean Spanish')),
+ ('es-ar', gettext_noop('Argentinean Spanish')),
+ ('eu', gettext_noop('Basque')),
('fa', gettext_noop('Persian')),
('fi', gettext_noop('Finnish')),
('fr', gettext_noop('French')),
View
BIN django/conf/locale/ca/LC_MESSAGES/django.mo
Binary file not shown.
View
869 django/conf/locale/ca/LC_MESSAGES/django.po
357 additions, 512 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
BIN django/conf/locale/ca/LC_MESSAGES/djangojs.mo
Binary file not shown.
View
12 django/conf/locale/ca/LC_MESSAGES/djangojs.po
@@ -9,14 +9,14 @@ msgstr ""
"Project-Id-Version: djangojs\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-05-20 18:25+0200\n"
-"PO-Revision-Date: 2007-12-01 12:06+0100\n"
-"Last-Translator: Antoni Aloy <antoni.aloy@trespams.com>\n"
+"PO-Revision-Date: 2008-01-22 19:39+0100\n"
+"Last-Translator: Marc Garcia <marc.garcia@accopensys.com>\n"
"Language-Team: español <ca@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.11.4\n"
-"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: contrib/admin/media/js/SelectFilter2.js:33
#, perl-format
@@ -50,9 +50,7 @@ msgstr "Deseleccionar tots"
#: contrib/admin/media/js/dateparse.js:32
#: contrib/admin/media/js/calendar.js:24
-msgid ""
-"January February March April May June July August September October November "
-"December"
+msgid "January February March April May June July August September October November December"
msgstr "Gener Febrer Març Abril Maig Juny Juliol Agost Setembre Octubre Novembre Desembre"
#: contrib/admin/media/js/dateparse.js:33
@@ -61,7 +59,7 @@ msgstr "Diumenge Dilluns Dimarts Dimecres Dijous Divendres Dissabte"
#: contrib/admin/media/js/calendar.js:25
msgid "S M T W T F S"
-msgstr "D L M X J V S"
+msgstr "Dg Dl Dt Dc Dj Dv Ds"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:47
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:81
View
BIN django/conf/locale/cy/LC_MESSAGES/django.mo
Binary file not shown.
View
1 django/conf/locale/cy/LC_MESSAGES/django.po
@@ -153,6 +153,7 @@ msgstr "Sgorau Carma"
#: contrib/comments/models.py:242
#, python-format
+#, fuzzy
msgid "%(score)d rating by %(user)s"
msgstr "%(score)d"
View
BIN django/conf/locale/de/LC_MESSAGES/django.mo
Binary file not shown.
View
28 django/conf/locale/de/LC_MESSAGES/django.po
@@ -2614,6 +2614,34 @@ msgstr "Samstag"
msgid "Sunday"
msgstr "Sonntag"
+#: utils/dates.py:10
+msgid "Mon"
+msgstr "Mo"
+
+#: utils/dates.py:10
+msgid "Tue"
+msgstr "Di"
+
+#: utils/dates.py:10
+msgid "Wed"
+msgstr "Mi"
+
+#: utils/dates.py:10
+msgid "Thu"
+msgstr "Do"
+
+#: utils/dates.py:10
+msgid "Fri"
+msgstr "Fr"
+
+#: utils/dates.py:11
+msgid "Sat"
+msgstr "Sa"
+
+#: utils/dates.py:11
+msgid "Sun"
+msgstr "So"
+
#: utils/dates.py:14
msgid "January"
msgstr "Januar"
View
BIN django/conf/locale/es_AR/LC_MESSAGES/django.mo
Binary file not shown.
View
1,328 django/conf/locale/es_AR/LC_MESSAGES/django.po
1,063 additions, 265 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
BIN django/conf/locale/eu/LC_MESSAGES/django.mo
Binary file not shown.
View
4,248 django/conf/locale/eu/LC_MESSAGES/django.po
4,248 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
BIN django/conf/locale/eu/LC_MESSAGES/djangojs.mo
Binary file not shown.
View
117 django/conf/locale/eu/LC_MESSAGES/djangojs.po
@@ -0,0 +1,117 @@
+# Spanish translation for the django-admin JS files.
+# Copyright (C)
+# This file is distributed under the same license as the PACKAGE package.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Django JavaScript 1.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2007-07-14 13:47-0500\n"
+"PO-Revision-Date: 2007-07-14 13:41-0500\n"
+"Last-Translator: Jorge Gajon <gajon@gajon.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: contrib/admin/media/js/calendar.js:24
+#: contrib/admin/media/js/dateparse.js:32
+msgid ""
+"January February March April May June July August September October November "
+"December"
+msgstr ""
+"Urtarrila Otsaila Martxoa Apirila Maiatza Ekaina Uztaila Abuztua Iraila Urria "
+"Azaroa Abendua"
+
+#: contrib/admin/media/js/calendar.js:25
+msgid "S M T W T F S"
+msgstr "I A A A O O L"
+
+#: contrib/admin/media/js/dateparse.js:33
+msgid "Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
+msgstr "Igandea Astelehene Asteartea Asteazkena Osteguna Ostirala Larunbata"
+
+#: contrib/admin/media/js/SelectFilter2.js:33
+#, perl-format
+msgid "Available %s"
+msgstr "%s Erabilgarri"
+
+#: contrib/admin/media/js/SelectFilter2.js:41
+msgid "Choose all"
+msgstr "Denak aukeratu"
+
+#: contrib/admin/media/js/SelectFilter2.js:46
+msgid "Add"
+msgstr "Gehitu"
+
+#: contrib/admin/media/js/SelectFilter2.js:48
+msgid "Remove"
+msgstr "Ezabatu"
+
+#: contrib/admin/media/js/SelectFilter2.js:53
+#, perl-format
+msgid "Chosen %s"
+msgstr "%s Aukeratuak"
+
+#: contrib/admin/media/js/SelectFilter2.js:54
+msgid "Select your choice(s) and click "
+msgstr "Egin zure aukerak eta click egin "
+
+#: contrib/admin/media/js/SelectFilter2.js:59
+msgid "Clear all"
+msgstr "Denak garbitu"
+
+#: contrib/admin/media/js/admin/DateTimeShortcuts.js:47
+#: contrib/admin/media/js/admin/DateTimeShortcuts.js:81
+msgid "Now"
+msgstr "Orain"
+
+#: contrib/admin/media/js/admin/DateTimeShortcuts.js:51
+msgid "Clock"
+msgstr "Erlojua"
+
+#: contrib/admin/media/js/admin/DateTimeShortcuts.js:78
+msgid "Choose a time"
+msgstr "Aukeratu ordu bat"
+
+#: contrib/admin/media/js/admin/DateTimeShortcuts.js:82
+msgid "Midnight"
+msgstr "Gauerdia"
+
+#: contrib/admin/media/js/admin/DateTimeShortcuts.js:83
+msgid "6 a.m."
+msgstr "6 a.m."
+
+#: contrib/admin/media/js/admin/DateTimeShortcuts.js:84
+msgid "Noon"
+msgstr "Eguerdia"
+
+#: contrib/admin/media/js/admin/DateTimeShortcuts.js:88
+#: contrib/admin/media/js/admin/DateTimeShortcuts.js:183
+msgid "Cancel"
+msgstr "Atzera"
+
+#: contrib/admin/media/js/admin/DateTimeShortcuts.js:128
+#: contrib/admin/media/js/admin/DateTimeShortcuts.js:177
+msgid "Today"
+msgstr "Gaur"
+
+#: contrib/admin/media/js/admin/DateTimeShortcuts.js:132
+msgid "Calendar"
+msgstr "Egutegia"
+
+#: contrib/admin/media/js/admin/DateTimeShortcuts.js:175
+msgid "Yesterday"
+msgstr "Atzo"
+
+#: contrib/admin/media/js/admin/DateTimeShortcuts.js:179
+msgid "Tomorrow"
+msgstr "Bihar"
+
+#: contrib/admin/media/js/admin/CollapsedFieldsets.js:34
+#: contrib/admin/media/js/admin/CollapsedFieldsets.js:72
+msgid "Show"
+msgstr "Erakutsi"
+
+#: contrib/admin/media/js/admin/CollapsedFieldsets.js:63
+msgid "Hide"
+msgstr "Izkutatu"
View
BIN django/conf/locale/fa/LC_MESSAGES/django.mo
Binary file not shown.
View
4,598 django/conf/locale/fa/LC_MESSAGES/django.po
2,990 additions, 1,608 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
BIN django/conf/locale/ga/LC_MESSAGES/django.mo
Binary file not shown.
View
4,167 django/conf/locale/ga/LC_MESSAGES/django.po
2,464 additions, 1,703 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
BIN django/conf/locale/ga/LC_MESSAGES/djangojs.mo
Binary file not shown.
View
50 django/conf/locale/ga/LC_MESSAGES/djangojs.po
@@ -8,8 +8,8 @@ msgstr ""
"Project-Id-Version: django 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-09-14 12:33+0100\n"
-"PO-Revision-Date: 2007-09-14 14:19+0100\n"
-"Last-Translator: Michael Thornhill <michael.thornhill@gmail.com>\n"
+"PO-Revision-Date: 2008-01-23 11:04+0100\n"
+"Last-Translator: Michael Thornhill <michael@maithu.com>\n"
"Language-Team: Gaeilge <ga@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -18,99 +18,99 @@ msgstr ""
#: contrib/admin/media/js/calendar.js:24
#: contrib/admin/media/js/dateparse.js:32
msgid "January February March April May June July August September October November December"
-msgstr ""
+msgstr "Eanair Feabhra Márta Aibreán Bealtaine Meitheamh Iúil Lúnasa Mean Fómhair Deireadh Fómhair Nollaig"
#: contrib/admin/media/js/calendar.js:25
msgid "S M T W T F S"
-msgstr ""
+msgstr "D L M C D A S"
#: contrib/admin/media/js/dateparse.js:33
msgid "Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
-msgstr ""
+msgstr "Domhnaigh Luain Máirt Céadaoin Déardaoin Aoine Sathairn"
#: contrib/admin/media/js/SelectFilter2.js:33
#, perl-format
msgid "Available %s"
-msgstr ""
+msgstr "%s ar fáil"
#: contrib/admin/media/js/SelectFilter2.js:41
msgid "Choose all"
-msgstr ""
+msgstr "Roghnaigh iomlán"
#: contrib/admin/media/js/SelectFilter2.js:46
msgid "Add"
-msgstr ""
+msgstr "Cuir le"
#: contrib/admin/media/js/SelectFilter2.js:48
msgid "Remove"
-msgstr ""
+msgstr "Bain amach"
#: contrib/admin/media/js/SelectFilter2.js:53
#, perl-format
msgid "Chosen %s"
-msgstr ""
+msgstr "Roghnófar %s"
#: contrib/admin/media/js/SelectFilter2.js:54
msgid "Select your choice(s) and click "
-msgstr ""
+msgstr "Roghnaigh do rogha agus cniog"
#: contrib/admin/media/js/SelectFilter2.js:59
msgid "Clear all"
-msgstr ""
+msgstr "Glan iomlán"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:47
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:81
msgid "Now"
-msgstr ""
+msgstr "Anois"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:51
msgid "Clock"
-msgstr ""
+msgstr "Clog"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:78
msgid "Choose a time"
-msgstr ""
+msgstr "Roghnaigh am"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:82
msgid "Midnight"
-msgstr ""
+msgstr "Meán oíche"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:83
msgid "6 a.m."
-msgstr ""
+msgstr "6 a.m."
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:84
msgid "Noon"
-msgstr ""
+msgstr "Nóin"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:88
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:183
msgid "Cancel"
-msgstr ""
+msgstr "Cealaigh"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:128
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:177
msgid "Today"
-msgstr ""
+msgstr "Inniu"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:132
msgid "Calendar"
-msgstr ""
+msgstr "Féilire"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:175
msgid "Yesterday"
-msgstr ""
+msgstr "Inné"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:179
msgid "Tomorrow"
-msgstr ""
+msgstr "Amárach"
#: contrib/admin/media/js/admin/CollapsedFieldsets.js:34
#: contrib/admin/media/js/admin/CollapsedFieldsets.js:72
msgid "Show"
-msgstr ""
+msgstr "Taispeán"
#: contrib/admin/media/js/admin/CollapsedFieldsets.js:63
msgid "Hide"
-msgstr ""
+msgstr "Folaigh"
View
BIN django/conf/locale/is/LC_MESSAGES/django.mo
Binary file not shown.
View
5,052 django/conf/locale/is/LC_MESSAGES/django.po
3,638 additions, 1,414 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
BIN django/conf/locale/it/LC_MESSAGES/django.mo
Binary file not shown.
View
5,479 django/conf/locale/it/LC_MESSAGES/django.po
3,209 additions, 2,270 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
BIN django/conf/locale/kn/LC_MESSAGES/django.mo
Binary file not shown.
View
3 django/conf/locale/kn/LC_MESSAGES/django.po
@@ -971,6 +971,7 @@ msgstr ""
#: contrib/admin/templates/admin/delete_confirmation.html:21
#, python-format
+#,fuzzy
msgid ""
"Are you sure you want to delete the %(object_name)s \"%(escaped_object)s\"? "
"All of the following related items will be deleted:"
@@ -2181,6 +2182,7 @@ msgstr ""
#: core/validators.py:256
#, python-format
+#,fuzzy
msgid "Watch your mouth! The word %s is not allowed here."
msgstr ""
"ನಾಲಿಗೆ ಬಿಗಿ ಹಿಡಿಯಿರಿ! %s "
@@ -2486,6 +2488,7 @@ msgstr ""
#: forms/__init__.py:381
#, python-format
+#,fuzzy
msgid "Ensure your text is less than %s character."
msgstr ""
"ನಿಮ್ಮ ಗದ್ಯ %s ಅಕ್ಷರಕ್ಕಿಂತ "
View
BIN django/conf/locale/pl/LC_MESSAGES/django.mo
Binary file not shown.
View
845 django/conf/locale/pl/LC_MESSAGES/django.po
667 additions, 178 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
BIN django/conf/locale/pt/LC_MESSAGES/django.mo
Binary file not shown.
View
3 django/conf/locale/pt/LC_MESSAGES/django.po
@@ -851,6 +851,7 @@ msgstr "Remover"
#: contrib/admin/templates/admin/delete_confirmation.html:14
#, python-format
+#, fuzzy
msgid ""
"Deleting the %(object_name)s '%(escaped_object)s' would result in deleting "
"related objects, but your account doesn't have permission to delete the "
@@ -1933,6 +1934,7 @@ msgstr[1] "Por favor introduza um número décimal com um máximo de %s digitos.
#: core/validators.py:381
#, python-format
+#, fuzzy
msgid ""
"Please enter a valid decimal number with a whole part of at most %s digit."
msgid_plural ""
@@ -1973,6 +1975,7 @@ msgstr "Não foi possível extrair nada de %s."
#: core/validators.py:466
#, python-format
+#, fuzzy
msgid ""
"The URL %(url)s returned the invalid Content-Type header '%(contenttype)s'."
msgstr "O URL %(url)s devolveu um tipo de conteúdo inválido no header: '%s(contenttype)s'."
View
BIN django/conf/locale/sv/LC_MESSAGES/django.mo
Binary file not shown.
View
5,301 django/conf/locale/sv/LC_MESSAGES/django.po
3,343 additions, 1,958 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
BIN django/conf/locale/sv/LC_MESSAGES/djangojs.mo
Binary file not shown.
View
21 django/conf/locale/sv/LC_MESSAGES/djangojs.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: djangojs\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-03-06 02:29+0100\n"
-"PO-Revision-Date: 2007-03-06 10:30+0100\n"
+"POT-Creation-Date: 2008-02-01 15:31+0100\n"
+"PO-Revision-Date: 2008-02-01 15:32+0100\n"
"Last-Translator: Mikko Hellsing <mikko@sorl.net>\n"
"Language-Team: Django I18N <Django-I18N@googlegroups.com>\n"
"MIME-Version: 1.0\n"
@@ -20,7 +20,7 @@ msgstr ""
#: contrib/admin/media/js/SelectFilter2.js:33
#, perl-format
msgid "Available %s"
-msgstr "Tillgänglig %s"
+msgstr "Tillgängliga %s"
#: contrib/admin/media/js/SelectFilter2.js:41
msgid "Choose all"
@@ -37,7 +37,7 @@ msgstr "Ta bort"
#: contrib/admin/media/js/SelectFilter2.js:53
#, perl-format
msgid "Chosen %s"
-msgstr "Vald %s"
+msgstr "Valda %s"
#: contrib/admin/media/js/SelectFilter2.js:54
msgid "Select your choice(s) and click "
@@ -47,8 +47,8 @@ msgstr "Gör dina val och klicka på "
msgid "Clear all"
msgstr "Ta bort alla"
-#: contrib/admin/media/js/dateparse.js:32
#: contrib/admin/media/js/calendar.js:24
+#: contrib/admin/media/js/dateparse.js:32
msgid ""
"January February March April May June July August September October November "
"December"
@@ -56,14 +56,14 @@ msgstr ""
"Januari Februari Mars April Maj Juni Juli Augusti September Oktober November "
"December"
-#: contrib/admin/media/js/dateparse.js:33
-msgid "Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
-msgstr "Söndag Måndag Tisdag Onsdag Torsdag Fredag Lördag"
-
#: contrib/admin/media/js/calendar.js:25
msgid "S M T W T F S"
msgstr "S M T O T F L"
+#: contrib/admin/media/js/dateparse.js:33
+msgid "Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
+msgstr "Söndag Måndag Tisdag Onsdag Torsdag Fredag Lördag"
+
#: contrib/admin/media/js/admin/CollapsedFieldsets.js:34
#: contrib/admin/media/js/admin/CollapsedFieldsets.js:72
msgid "Show"
@@ -118,5 +118,4 @@ msgstr "Igår"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:179
msgid "Tomorrow"
-msgstr "I morgon"
-
+msgstr "Imorgon"
View
2 django/conf/project_template/settings.py
@@ -18,7 +18,7 @@
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
-# although not all choices may be avilable on all operating systems.
+# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Chicago'
View
2 django/conf/urls/shortcut.py
@@ -1,5 +1,5 @@
from django.conf.urls.defaults import *
urlpatterns = patterns('django.views',
- (r'^(?P<content_type_id>\d+)/(?P<object_id>\d+)/$', 'defaults.shortcut'),
+ (r'^(?P<content_type_id>\d+)/(?P<object_id>.*)/$', 'defaults.shortcut'),
)
View
2 django/contrib/admin/urls.py
@@ -2,7 +2,7 @@
urlpatterns = patterns('',
#('^$', 'django.contrib.admin.views.main.index'),
- ('^r/(\d+)/(.*)/$', 'django.views.defaults.shortcut'),
+ ('^r/', include('django.conf.urls.shortcut')),
#('^jsi18n/$', i18n_view, {'packages': 'django.conf'}),
#('^logout/$', 'django.contrib.auth.views.logout'),
#('^password_change/$', 'django.contrib.auth.views.password_change'),
View
22 django/contrib/comments/models.py
@@ -1,25 +1,27 @@
+import datetime
+
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
-import datetime
MIN_PHOTO_DIMENSION = 5
MAX_PHOTO_DIMENSION = 1000
-# option codes for comment-form hidden fields
+# Option codes for comment-form hidden fields.
PHOTOS_REQUIRED = 'pr'
PHOTOS_OPTIONAL = 'pa'
RATINGS_REQUIRED = 'rr'
RATINGS_OPTIONAL = 'ra'
IS_PUBLIC = 'ip'
-# what users get if they don't have any karma
+# What users get if they don't have any karma.
DEFAULT_KARMA = 5
KARMA_NEEDED_BEFORE_DISPLAYED = 3
+
class CommentManager(models.Manager):
def get_security_hash(self, options, photo_options, rating_options, target):
"""
@@ -61,7 +63,9 @@ def user_is_moderator(self, user):
return True
return False
+
class Comment(models.Model):
+ """A comment by a registered user."""
user = models.ForeignKey(User)
content_type = models.ForeignKey(ContentType)
object_id = models.IntegerField(_('object ID'))
@@ -124,7 +128,7 @@ def get_content_object(self):
get_content_object.short_description = _('Content object')
def _fill_karma_cache(self):
- "Helper function that populates good/bad karma caches"
+ """Helper function that populates good/bad karma caches."""
good, bad = 0, 0
for k in self.karmascore_set:
if k.score == -1:
@@ -153,8 +157,9 @@ def get_as_text(self):
{'user': self.user.username, 'date': self.submit_date,
'comment': self.comment, 'domain': self.site.domain, 'url': self.get_absolute_url()}
+
class FreeComment(models.Model):
- # A FreeComment is a comment by a non-registered user.
+ """A comment by a non-registered user."""
content_type = models.ForeignKey(ContentType)
object_id = models.IntegerField(_('object ID'))
comment = models.TextField(_('comment'), max_length=3000)
@@ -193,6 +198,7 @@ def get_content_object(self):
get_content_object.short_description = _('Content object')
+
class KarmaScoreManager(models.Manager):
def vote(self, user_id, comment_id, score):
try:
@@ -214,6 +220,7 @@ def get_pretty_score(self, score):
return DEFAULT_KARMA
return int(round((4.5 * score) + 5.5))
+
class KarmaScore(models.Model):
user = models.ForeignKey(User)
comment = models.ForeignKey(Comment)
@@ -229,6 +236,7 @@ class Meta:
def __unicode__(self):
return _("%(score)d rating by %(user)s") % {'score': self.score, 'user': self.user}
+
class UserFlagManager(models.Manager):
def flag(self, comment, user):
"""
@@ -239,7 +247,7 @@ def flag(self, comment, user):
if int(comment.user_id) == int(user.id):
return # A user can't flag his own comment. Fail silently.
try:
- f = self.objects.get(user__pk=user.id, comment__pk=comment.id)
+ f = self.get(user__pk=user.id, comment__pk=comment.id)
except self.model.DoesNotExist:
from django.core.mail import mail_managers
f = self.model(None, user.id, comment.id, None)
@@ -247,6 +255,7 @@ def flag(self, comment, user):
mail_managers('Comment flagged', message, fail_silently=True)
f.save()
+
class UserFlag(models.Model):
user = models.ForeignKey(User)
comment = models.ForeignKey(Comment)
@@ -261,6 +270,7 @@ class Meta:
def __unicode__(self):
return _("Flag by %r") % self.user
+
class ModeratorDeletion(models.Model):
user = models.ForeignKey(User, verbose_name='moderator')
comment = models.ForeignKey(Comment)
View
2 django/contrib/databrowse/datastructures.py
@@ -105,7 +105,7 @@ def pk(self):
return self.instance._get_pk_val()
def url(self):
- return '%s%s/%s/objects/%s/' % (self.model.site.root_url, self.model.model._meta.app_label, self.model.model._meta.module_name, iri_to_uri(self.pk()))
+ return mark_safe('%s%s/%s/objects/%s/' % (self.model.site.root_url, self.model.model._meta.app_label, self.model.model._meta.module_name, iri_to_uri(self.pk())))
def fields(self):
"""
View
6 django/contrib/localflavor/ar/forms.py
@@ -20,7 +20,7 @@ def __init__(self, attrs=None):
class ARPostalCodeField(RegexField):
"""
- A field that accepts a `classic´ NNNN Postal Code or a CPA.
+ A field that accepts a 'classic' NNNN Postal Code or a CPA.
See http://www.correoargentino.com.ar/consulta_cpa/home.php
"""
@@ -44,7 +44,7 @@ def clean(self, value):
class ARDNIField(CharField):
"""
- A field that validates `Documento Nacional de Identidad´ (DNI) numbers.
+ A field that validates 'Documento Nacional de Identidad' (DNI) numbers.
"""
default_error_messages = {
'invalid': ugettext("This field requires only numbers."),
@@ -73,7 +73,7 @@ def clean(self, value):
class ARCUITField(RegexField):
"""
- This field validates a CUIT (Código Único de Identificación Tributaria). A
+ This field validates a CUIT (Código Único de Identificación Tributaria). A
CUIT is of the form XX-XXXXXXXX-V. The last digit is a check digit.
"""
default_error_messages = {
View
2 django/contrib/localflavor/uk/uk_regions.py
@@ -55,7 +55,7 @@
("County Antrim", _("County Antrim")),
("County Armagh", _("County Armagh")),
("County Down", _("County Down")),
- ("County Fermanagh", _("County Down")),
+ ("County Fermanagh", _("County Fermanagh")),
("County Londonderry", _("County Londonderry")),
("County Tyrone", _("County Tyrone")),
)
View
5 django/contrib/syndication/feeds.py
@@ -6,7 +6,7 @@
from django.conf import settings
def add_domain(domain, url):
- if not url.startswith('http://'):
+ if not (url.startswith('http://') or url.startswith('https://')):
# 'url' must already be ASCII and URL-quoted, so no need for encoding
# conversions here.
url = iri_to_uri(u'http://%s%s' % (domain, url))
@@ -82,7 +82,8 @@ def get_feed(self, url=None):
link = link,
description = self.__get_dynamic_attr('description', obj),
language = settings.LANGUAGE_CODE.decode(),
- feed_url = add_domain(current_site, self.__get_dynamic_attr('feed_url', obj)),
+ feed_url = add_domain(current_site.domain,
+ self.__get_dynamic_attr('feed_url', obj)),
author_name = self.__get_dynamic_attr('author_name', obj),
author_link = self.__get_dynamic_attr('author_link', obj),
author_email = self.__get_dynamic_attr('author_email', obj),
View
8 django/core/handlers/base.py
@@ -111,13 +111,13 @@ def get_response(self, request):
except SystemExit:
pass # See http://code.djangoproject.com/ticket/1023
except: # Handle everything else, including SuspiciousOperation, etc.
+ # Get the exception info now, in case another exception is thrown later.
+ exc_info = sys.exc_info()
+ receivers = dispatcher.send(signal=signals.got_request_exception, request=request)
if settings.DEBUG:
from django.views import debug
- return debug.technical_500_response(request, *sys.exc_info())
+ return debug.technical_500_response(request, *exc_info)
else:
- # Get the exception info now, in case another exception is thrown later.
- exc_info = sys.exc_info()
- receivers = dispatcher.send(signal=signals.got_request_exception, request=request)
# When DEBUG is False, send an error message to the admins.
subject = 'Error (%s IP): %s' % ((request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS and 'internal' or 'EXTERNAL'), request.path)
try:
View
6 django/core/management/commands/loaddata.py
@@ -59,7 +59,7 @@ def handle(self, *fixture_labels, **options):
else:
formats = []
- if verbosity > 2:
+ if verbosity >= 2:
if formats:
print "Loading '%s' fixtures..." % fixture_name
else:
@@ -109,7 +109,7 @@ def handle(self, *fixture_labels, **options):
return
fixture.close()
except:
- if verbosity > 2:
+ if verbosity >= 2:
print "No %s fixture '%s' in %s." % \
(format, fixture_name, humanize(fixture_dir))
@@ -125,7 +125,7 @@ def handle(self, *fixture_labels, **options):
transaction.leave_transaction_management()
if count[0] == 0:
- if verbosity > 2:
+ if verbosity >= 2:
print "No fixtures found."
else:
if verbosity > 0:
View
2 django/core/management/commands/sqlall.py
@@ -1,7 +1,7 @@
from django.core.management.base import AppCommand
class Command(AppCommand):
- help = "Prints the CREATE TABLE, initial-data and CREATE INDEX SQL statements for the given model module name(s)."
+ help = "Prints the CREATE TABLE, custom SQL and CREATE INDEX SQL statements for the given model module name(s)."
output_transaction = True
View
75 django/db/models/base.py
@@ -24,7 +24,8 @@ class ModelBase(type):
def __new__(cls, name, bases, attrs):
# If this isn't a subclass of Model, don't do anything special.
try:
- if not filter(lambda b: issubclass(b, Model), bases):
+ parents = [b for b in bases if issubclass(b, Model)]
+ if not parents:
return super(ModelBase, cls).__new__(cls, name, bases, attrs)
except NameError:
# 'Model' isn't defined yet, meaning we're looking at Django's own
@@ -39,9 +40,10 @@ def __new__(cls, name, bases, attrs):
types.ClassType('MultipleObjectsReturned', (MultipleObjectsReturned, ), {}))
# Build complete list of parents
- for base in bases:
- # TODO: Checking for the presence of '_meta' is hackish.
- if '_meta' in dir(base):
+ for base in parents:
+ # Things without _meta aren't functional models, so they're
+ # uninteresting parents.
+ if hasattr(base, '_meta'):
new_class._meta.parents.append(base)
new_class._meta.parents.extend(base._meta.parents)
@@ -79,6 +81,35 @@ def __new__(cls, name, bases, attrs):
# registered version.
return get_model(new_class._meta.app_label, name, False)
+ def add_to_class(cls, name, value):
+ if name == 'Admin':
+ assert type(value) == types.ClassType, "%r attribute of %s model must be a class, not a %s object" % (name, cls.__name__, type(value))
+ value = AdminOptions(**dict([(k, v) for k, v in value.__dict__.items() if not k.startswith('_')]))
+ if hasattr(value, 'contribute_to_class'):
+ value.contribute_to_class(cls, name)
+ else:
+ setattr(cls, name, value)
+
+ def _prepare(cls):
+ # Creates some methods once self._meta has been populated.
+ opts = cls._meta
+ opts._prepare(cls)
+
+ if opts.order_with_respect_to:
+ cls.get_next_in_order = curry(cls._get_next_or_previous_in_order, is_next=True)
+ cls.get_previous_in_order = curry(cls._get_next_or_previous_in_order, is_next=False)
+ setattr(opts.order_with_respect_to.rel.to, 'get_%s_order' % cls.__name__.lower(), curry(method_get_order, cls))
+ setattr(opts.order_with_respect_to.rel.to, 'set_%s_order' % cls.__name__.lower(), curry(method_set_order, cls))
+
+ # Give the class a docstring -- its definition.
+ if cls.__doc__ is None:
+ cls.__doc__ = "%s(%s)" % (cls.__name__, ", ".join([f.attname for f in opts.fields]))
+
+ if hasattr(cls, 'get_absolute_url'):
+ cls.get_absolute_url = curry(get_absolute_url, opts, cls.get_absolute_url)
+
+ dispatcher.send(signal=signals.class_prepared, sender=cls)
+
class Model(object):
__metaclass__ = ModelBase
@@ -110,7 +141,7 @@ def __init__(self, *args, **kwargs):
# There is a rather weird disparity here; if kwargs, it's set, then args
# overrides it. It should be one or the other; don't duplicate the work
# The reason for the kwargs check is that standard iterator passes in by
- # args, and nstantiation for iteration is 33% faster.
+ # args, and instantiation for iteration is 33% faster.
args_len = len(args)
if args_len > len(self._meta.fields):
# Daft, but matches old exception sans the err msg.
@@ -176,37 +207,9 @@ def __init__(self, *args, **kwargs):
raise TypeError, "'%s' is an invalid keyword argument for this function" % kwargs.keys()[0]
dispatcher.send(signal=signals.post_init, sender=self.__class__, instance=self)
- def add_to_class(cls, name, value):
- if hasattr(value, 'contribute_to_class'):
- value.contribute_to_class(cls, name)
- else:
- setattr(cls, name, value)
- add_to_class = classmethod(add_to_class)
-
- def _prepare(cls):
- # Creates some methods once self._meta has been populated.
- opts = cls._meta
- opts._prepare(cls)
-
- if opts.order_with_respect_to:
- cls.get_next_in_order = curry(cls._get_next_or_previous_in_order, is_next=True)
- cls.get_previous_in_order = curry(cls._get_next_or_previous_in_order, is_next=False)
- setattr(opts.order_with_respect_to.rel.to, 'get_%s_order' % cls.__name__.lower(), curry(method_get_order, cls))
- setattr(opts.order_with_respect_to.rel.to, 'set_%s_order' % cls.__name__.lower(), curry(method_set_order, cls))
-
- # Give the class a docstring -- its definition.
- if cls.__doc__ is None:
- cls.__doc__ = "%s(%s)" % (cls.__name__, ", ".join([f.attname for f in opts.fields]))
-
- if hasattr(cls, 'get_absolute_url'):
- cls.get_absolute_url = curry(get_absolute_url, opts, cls.get_absolute_url)
-
- dispatcher.send(signal=signals.class_prepared, sender=cls)
-
- _prepare = classmethod(_prepare)
-
def save(self, raw=False):
- dispatcher.send(signal=signals.pre_save, sender=self.__class__, instance=self)
+ dispatcher.send(signal=signals.pre_save, sender=self.__class__,
+ instance=self, raw=raw)
non_pks = [f for f in self._meta.fields if not f.primary_key]
cursor = connection.cursor()
@@ -267,7 +270,7 @@ def save(self, raw=False):
# Run any post-save hooks.
dispatcher.send(signal=signals.post_save, sender=self.__class__,
- instance=self, created=(not record_exists))
+ instance=self, created=(not record_exists), raw=raw)
save.alters_data = True
View
12 django/middleware/gzip.py
@@ -22,12 +22,12 @@ def process_response(self, request, response):
if response.has_header('Content-Encoding'):
return response
- # Older versions of IE have issues with gzipped javascript.
- # See http://code.djangoproject.com/ticket/2449
- is_ie = "msie" in request.META.get('HTTP_USER_AGENT', '').lower()
- is_js = "javascript" in response.get('Content-Type', '').lower()
- if is_ie and is_js:
- return response
+ # Older versions of IE have issues with gzipped pages containing either
+ # Javascript and PDF.
+ if "msie" in request.META.get('HTTP_USER_AGENT', '').lower():
+ ctype = response.get('Content-Type', '').lower()
+ if "javascript" in ctype or ctype == "application/pdf":
+ return response
ae = request.META.get('HTTP_ACCEPT_ENCODING', '')
if not re_accepts_gzip.search(ae):
View
2 django/newforms/fields.py
@@ -466,6 +466,8 @@ def clean(self, data, initial=None):
f = super(ImageField, self).clean(data, initial)
if f is None:
return None
+ elif not data and initial:
+ return initial
from PIL import Image
from cStringIO import StringIO
try:
View
37 django/newforms/forms.py
@@ -22,24 +22,41 @@ def pretty_name(name):
name = name[0].upper() + name[1:]
return name.replace('_', ' ')
-class DeclarativeFieldsMetaclass(type):
+def get_declared_fields(bases, attrs, with_base_fields=True):
"""
- Metaclass that converts Field attributes to a dictionary called
- 'base_fields', taking into account parent class 'base_fields' as well.
+ Create a list of form field instances from the passed in 'attrs', plus any
+ similar fields on the base classes (in 'bases'). This is used by both the
+ Form and ModelForm metclasses.
+
+ If 'with_base_fields' is True, all fields from the bases are used.
+ Otherwise, only fields in the 'declared_fields' attribute on the bases are
+ used. The distinction is useful in ModelForm subclassing.
Also integrates any additional media definitions
"""
- def __new__(cls, name, bases, attrs):
- fields = [(field_name, attrs.pop(field_name)) for field_name, obj in attrs.items() if isinstance(obj, Field)]
- fields.sort(lambda x, y: cmp(x[1].creation_counter, y[1].creation_counter))
+ fields = [(field_name, attrs.pop(field_name)) for field_name, obj in attrs.items() if isinstance(obj, Field)]
+ fields.sort(lambda x, y: cmp(x[1].creation_counter, y[1].creation_counter))
- # If this class is subclassing another Form, add that Form's fields.
- # Note that we loop over the bases in *reverse*. This is necessary in
- # order to preserve the correct order of fields.
+ # If this class is subclassing another Form, add that Form's fields.
+ # Note that we loop over the bases in *reverse*. This is necessary in
+ # order to preserve the correct order of fields.
+ if with_base_fields:
for base in bases[::-1]:
if hasattr(base, 'base_fields'):
fields = base.base_fields.items() + fields
+ else:
+ for base in bases[::-1]:
+ if hasattr(base, 'declared_fields'):
+ fields = base.declared_fields.items() + fields
+
+ return SortedDict(fields)
- attrs['base_fields'] = SortedDict(fields)
+class DeclarativeFieldsMetaclass(type):
+ """
+ Metaclass that converts Field attributes to a dictionary called
+ 'base_fields', taking into account parent class 'base_fields' as well.
+ """
+ def __new__(cls, name, bases, attrs):
+ attrs['base_fields'] = get_declared_fields(bases, attrs)
new_class = type.__new__(cls, name, bases, attrs)
if 'media' not in attrs:
View
75 django/newforms/models.py
@@ -11,7 +11,7 @@
from django.core.exceptions import ImproperlyConfigured
from util import ValidationError, ErrorList
-from forms import BaseForm
+from forms import BaseForm, get_declared_fields
from fields import Field, ChoiceField, IntegerField, EMPTY_VALUES
from formsets import BaseFormSet, formset_for_form, DELETION_FIELD_NAME
from widgets import Select, SelectMultiple, HiddenInput, MultipleHiddenInput
@@ -213,57 +213,39 @@ def __init__(self, options=None):
self.fields = getattr(options, 'fields', None)
self.exclude = getattr(options, 'exclude', None)
+
class ModelFormMetaclass(type):
def __new__(cls, name, bases, attrs,
formfield_callback=lambda f: f.formfield()):
- fields = [(field_name, attrs.pop(field_name)) for field_name, obj in attrs.items() if isinstance(obj, Field)]
- fields.sort(lambda x, y: cmp(x[1].creation_counter, y[1].creation_counter))
-
- # If this class is subclassing another Form, add that Form's fields.
- # Note that we loop over the bases in *reverse*. This is necessary in
- # order to preserve the correct order of fields.
- for base in bases[::-1]:
- if hasattr(base, 'base_fields'):
- fields = base.base_fields.items() + fields
- declared_fields = SortedDict(fields)
-
- opts = ModelFormOptions(attrs.get('Meta', None))
- attrs['_meta'] = opts
-
- # Don't allow more than one Meta model defenition in bases. The fields
- # would be generated correctly, but the save method won't deal with
- # more than one object.
- base_models = []
- for base in bases:
- base_opts = getattr(base, '_meta', None)
- base_model = getattr(base_opts, 'model', None)
- if base_model is not None:
- base_models.append(base_model)
- if len(base_models) > 1:
- raise ImproperlyConfigured("%s's base classes define more than one model." % name)
-
- # If a model is defined, extract form fields from it and add them to base_fields
- if attrs['_meta'].model is not None:
- # Don't allow a subclass to define a different Meta model than a
- # parent class has. Technically the right fields would be generated,
- # but the save method will not deal with more than one model.
- for base in bases:
- base_opts = getattr(base, '_meta', None)
- base_model = getattr(base_opts, 'model', None)
- if base_model and base_model is not opts.model:
- raise ImproperlyConfigured('%s defines a different model than its parent.' % name)
- model_fields = fields_for_model(opts.model, opts.fields,
- opts.exclude, formfield_callback)
- # fields declared in base classes override fields from the model
- model_fields.update(declared_fields)
- attrs['base_fields'] = model_fields
+ try:
+ parents = [b for b in bases if issubclass(b, ModelForm)]
+ except NameError:
+ # We are defining ModelForm itself.
+ parents = None
+ if not parents:
+ return super(ModelFormMetaclass, cls).__new__(cls, name, bases,
+ attrs)
+
+ new_class = type.__new__(cls, name, bases, attrs)
+ declared_fields = get_declared_fields(bases, attrs, False)
+ opts = new_class._meta = ModelFormOptions(getattr(new_class, 'Meta', None))
+ if opts.model:
+ # If a model is defined, extract form fields from it.
+ fields = fields_for_model(opts.model, opts.fields,
+ opts.exclude, formfield_callback)
+ # Override default model fields with any custom declared ones
+ # (plus, include all the other declared fields).
+ fields.update(declared_fields)
else:
- attrs['base_fields'] = declared_fields
- return type.__new__(cls, name, bases, attrs)
+ fields = declared_fields
+ new_class.declared_fields = declared_fields
+ new_class.base_fields = fields
+ return new_class
class BaseModelForm(BaseForm):
def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
- initial=None, error_class=ErrorList, label_suffix=':', instance=None):
+ initial=None, error_class=ErrorList, label_suffix=':',
+ instance=None):
opts = self._meta
if instance is None:
# if we didn't get an instance, instantiate a new one
@@ -279,7 +261,8 @@ def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
def save(self, commit=True):
"""
- Saves this ``form``'s cleaned_data into model instance ``self.instance``.
+ Saves this ``form``'s cleaned_data into model instance
+ ``self.instance``.
If commit=True, then the changes to ``instance`` will be saved to the
database. Returns ``instance``.
View
2 django/newforms/widgets.py
@@ -547,7 +547,7 @@ def render(self, name, value, attrs=None):
if id_:
final_attrs = dict(final_attrs, id='%s_%s' % (id_, i))
output.append(widget.render(name + '_%s' % i, widget_value, final_attrs))
- return self.format_output(output)
+ return mark_safe(self.format_output(output))
def id_for_label(self, id_):
# See the comment for RadioSelect.id_for_label()
View
16 django/template/__init__.py
@@ -289,6 +289,14 @@ def create_nodelist(self):
return NodeList()
def extend_nodelist(self, nodelist, node, token):
+ if node.must_be_first and nodelist:
+ try:
+ if nodelist.contains_nontext:
+ raise AttributeError
+ except AttributeError:
+ raise TemplateSyntaxError("%r must be the first tag in the template." % node)
+ if isinstance(nodelist, NodeList) and not isinstance(node, TextNode):
+ nodelist.contains_nontext = True
nodelist.append(node)
def enter_command(self, command, token):
@@ -708,6 +716,10 @@ def _resolve_lookup(self, context):
return current
class Node(object):
+ # Set this to True for nodes that must be first in the template (although
+ # they can be preceded by text nodes.
+ must_be_first = False
+
def render(self, context):
"Return the node rendered as a string"
pass
@@ -725,6 +737,10 @@ def get_nodes_by_type(self, nodetype):
return nodes
class NodeList(list):
+ # Set to True the first time a non-TextNode is inserted by
+ # extend_nodelist().
+ contains_nontext = False
+
def render(self, context):
bits = []
for node in self:
View
2 django/template/defaultfilters.py
@@ -343,7 +343,7 @@ def force_escape(value):
"""
from django.utils.html import escape
return mark_safe(escape(value))
-escape = stringfilter(escape)
+force_escape = stringfilter(force_escape)
force_escape.is_safe = True
def linebreaks(value, autoescape=None):
View
18 django/template/loader_tags.py
@@ -1,5 +1,5 @@
from django.template import TemplateSyntaxError, TemplateDoesNotExist, Variable
-from django.template import Library, Node
+from django.template import Library, Node, TextNode
from django.template.loader import get_template, get_template_from_string, find_template_source
from django.conf import settings
from django.utils.safestring import mark_safe
@@ -37,11 +37,18 @@ def add_parent(self, nodelist):
self.parent = BlockNode(self.name, nodelist)
class ExtendsNode(Node):
+ must_be_first = True
+
def __init__(self, nodelist, parent_name, parent_name_expr, template_dirs=None):
self.nodelist = nodelist
self.parent_name, self.parent_name_expr = parent_name, parent_name_expr
self.template_dirs = template_dirs
+ def __repr__(self):
+ if self.parent_name_expr:
+ return "<ExtendsNode: extends %s>" % self.parent_name_expr.token
+ return '<ExtendsNode: extends "%s">' % self.parent_name
+
def get_parent(self, context):
if self.parent_name_expr:
self.parent_name = self.parent_name_expr.resolve(context)
@@ -49,7 +56,7 @@ def get_parent(self, context):
if not parent:
error_msg = "Invalid template name in 'extends' tag: %r." % parent
if self.parent_name_expr:
- error_msg += " Got this from the %r variable." % self.parent_name_expr #TODO nice repr.
+ error_msg += " Got this from the '%s' variable." % self.parent_name_expr.token
raise TemplateSyntaxError, error_msg
if hasattr(parent, 'render'):
return parent # parent is a Template object
@@ -62,7 +69,10 @@ def get_parent(self, context):
def render(self, context):
compiled_parent = self.get_parent(context)
- parent_is_child = isinstance(compiled_parent.nodelist[0], ExtendsNode)
+ pos = 0
+ while isinstance(compiled_parent.nodelist[pos], TextNode):
+ pos += 1
+ parent_is_child = isinstance(compiled_parent.nodelist[pos], ExtendsNode)
parent_blocks = dict([(n.name, n) for n in compiled_parent.nodelist.get_nodes_by_type(BlockNode)])
for block_node in self.nodelist.get_nodes_by_type(BlockNode):
# Check for a BlockNode with this node's name, and replace it if found.
@@ -74,7 +84,7 @@ def render(self, context):
# add this BlockNode to the parent's ExtendsNode nodelist, so
# it'll be checked when the parent node's render() is called.
if parent_is_child:
- compiled_parent.nodelist[0].nodelist.append(block_node)
+ compiled_parent.nodelist[pos].nodelist.append(block_node)
else:
# Keep any existing parents and add a new one. Used by BlockNode.
parent_block.parent = block_node.parent
View
4 django/test/client.py
@@ -262,7 +262,7 @@ def login(self, **credentials):
self.cookies[settings.SESSION_COOKIE_NAME]['expires'] = None
# Save the session values
- request.session.save()
+ request.session.save()
return True
else:
@@ -274,5 +274,5 @@ def logout(self):
Causes the authenticated user to be logged out.
"""
session = __import__(settings.SESSION_ENGINE, {}, {}, ['']).SessionStore()
- session.delete(session_key=self.cookies['sessionid'].value)
+ session.delete(session_key=self.cookies[settings.SESSION_COOKIE_NAME].value)
self.cookies = SimpleCookie()
View
11 django/test/testcases.py
@@ -70,7 +70,14 @@ def __call__(self, result=None):
include a call to super().setUp().
"""
self.client = Client()
- self._pre_setup()
+ try:
+ self._pre_setup()
+ except (KeyboardInterrupt, SystemExit):
+ raise
+ except Exception:
+ import sys
+ result.addError(self, sys.exc_info())
+ return
super(TestCase, self).__call__(result)
def assertRedirects(self, response, expected_url, status_code=302,
@@ -103,7 +110,7 @@ def assertRedirects(self, response, expected_url, status_code=302,
def assertContains(self, response, text, count=None, status_code=200):
"""
- Asserts that a response indicates that a page was retreived
+ Asserts that a response indicates that a page was retrieved
successfully, (i.e., the HTTP status code was as expected), and that
``text`` occurs ``count`` times in the content of the response.
If ``count`` is None, the count doesn't matter - the assertion is true
View
9 django/utils/datastructures.py
@@ -2,6 +2,9 @@ class MergeDict(object):
"""
A simple class for creating new "virtual" dictionaries that actually look
up values in more than one dictionary, passed in the constructor.
+
+ If a key appears in more than one of the passed in dictionaries, only the
+ first occurrence will be used.
"""
def __init__(self, *dicts):
self.dicts = dicts
@@ -25,11 +28,9 @@ def get(self, key, default=None):
def getlist(self, key):
for dict_ in self.dicts:
- try:
+ if key in dict_.keys():
return dict_.getlist(key)
- except KeyError:
- pass
- raise KeyError
+ return []
def items(self):
item_list = []
View
2 django/utils/encoding.py
@@ -98,5 +98,5 @@ def iri_to_uri(iri):
# section 3.1 of RFC 3987.
if iri is None:
return iri
- return urllib.quote(smart_str(iri), safe='/#%[]=:;$&()+,!?')
+ return urllib.quote(smart_str(iri), safe='/#%[]=:;$&()+,!?*')
View
2 django/utils/feedgenerator.py
@@ -53,7 +53,7 @@ def __init__(self, title, link, description, language=None, author_email=None,
'title': to_unicode(title),
'link': iri_to_uri(link),
'description': to_unicode(description),
- 'language': force_unicode(language),
+ 'language': to_unicode(language),
'author_email': to_unicode(author_email),
'author_name': to_unicode(author_name),
'author_link': iri_to_uri(author_link),
View
23 django/utils/html.py
@@ -102,18 +102,23 @@ def urlize(text, trim_url_limit=None, nofollow=False, autoescape=False):
if middle.startswith('www.') or ('@' not in middle and not middle.startswith('http://') and \
len(middle) > 0 and middle[0] in string.ascii_letters + string.digits and \
(middle.endswith('.org') or middle.endswith('.net') or middle.endswith('.com'))):
- middle = '<a href="http://%s"%s>%s</a>' % (
- urlquote(middle, safe='/&=:;#?+'), nofollow_attr,
- trim_url(middle))
+ middle = 'http://%s' % middle
if middle.startswith('http://') or middle.startswith('https://'):
- middle = '<a href="%s"%s>%s</a>' % (
- urlquote(middle, safe='/&=:;#?+'), nofollow_attr,
- trim_url(middle))
- if '@' in middle and not middle.startswith('www.') and \
- not ':' in middle and simple_email_re.match(middle):
+ url = urlquote(middle, safe='/&=:;#?+*')
+ if autoescape and not safe_input:
+ url = escape(url)
+ trimmed_url = trim_url(middle)
+ middle = '<a href="%s"%s>%s</a>' % (url, nofollow_attr,
+ trimmed_url)
+ elif '@' in middle and not middle.startswith('www.') and \
+ not ':' in middle and simple_email_re.match(middle):
+ if autoescape:
+ middle = conditional_escape(middle)
middle = '<a href="mailto:%s">%s</a>' % (middle, middle)
if lead + middle + trail != word:
- words[i] = lead + middle + trail
+ if autoescape and not safe_input:
+ lead, trail = escape(lead), escape(trail)
+ words[i] = mark_safe('%s%s%s' % (lead, middle, trail))
elif autoescape and not safe_input:
words[i] = escape(word)
elif safe_input:
View
21 django/utils/translation/trans_real.py
@@ -42,7 +42,10 @@ def currentThread():
''', re.VERBOSE)
def to_locale(language, to_lower=False):
- "Turns a language name (en-us) into a locale name (en_US)."
+ """
+ Turns a language name (en-us) into a locale name (en_US). If 'to_lower' is
+ True, the last component is lower-cased (en_us).
+ """
p = language.find('-')
if p >= 0:
if to_lower:
@@ -357,19 +360,20 @@ def get_language_from_request(request):
return lang_code
accept = request.META.get('HTTP_ACCEPT_LANGUAGE', '')
- for lang, unused in parse_accept_lang_header(accept):
- if lang == '*':
+ for accept_lang, unused in parse_accept_lang_header(accept):
+ if accept_lang == '*':
break
# We have a very restricted form for our language files (no encoding
# specifier, since they all must be UTF-8 and only one possible
# language each time. So we avoid the overhead of gettext.find() and
- # look up the MO file manually.
+ # work out the MO file manually.
- normalized = locale.locale_alias.get(to_locale(lang, True))
+ # 'normalized' is the root name of the locale in POSIX format (which is
+ # the format used for the directories holding the MO files).
+ normalized = locale.locale_alias.get(to_locale(accept_lang, True))
if not normalized:
continue
-
# Remove the default encoding from locale_alias
normalized = normalized.split('.')[0]
@@ -378,10 +382,11 @@ def get_language_from_request(request):
# need to check again.
return _accepted[normalized]
- for lang in (normalized, normalized.split('_')[0]):
+ for lang, dirname in ((accept_lang, normalized),
+ (accept_lang.split('-')[0], normalized.split('_')[0])):
if lang not in supported:
continue
- langfile = os.path.join(globalpath, lang, 'LC_MESSAGES',
+ langfile = os.path.join(globalpath, dirname, 'LC_MESSAGES',
'django.mo')
if os.path.exists(langfile):
_accepted[normalized] = lang
View
18 django/views/debug.py
@@ -73,6 +73,12 @@ def technical_500_response(request, exc_type, exc_value, tb):
template_info = None
template_does_not_exist = False
loader_debug_info = None
+
+ # Handle deprecated string exceptions
+ if isinstance(exc_type, basestring):
+ exc_value = Exception('Deprecated String Exception: %r' % exc_type)
+ exc_type = type(exc_value)
+
if issubclass(exc_type, TemplateDoesNotExist):
from django.template.loader import template_source_loaders
template_does_not_exist = True
@@ -192,9 +198,11 @@ def _get_lines_from_file(filename, lineno, context_lines, loader=None, module_na
Returns (pre_context_lineno, pre_context, context_line, post_context).
"""
source = None
- if loader is not None:
- source = loader.get_source(module_name).splitlines()
- else:
+ if loader is not None and hasattr(loader, "get_source"):
+ source = loader.get_source(module_name)
+ if source is not None:
+ source = source.splitlines()
+ if source is None:
try:
f = open(filename)
try:
@@ -431,11 +439,11 @@ def _get_lines_from_file(filename, lineno, context_lines, loader=None, module_na
{% if frame.context_line %}
<div class="context" id="c{{ frame.id }}">
{% if frame.pre_context %}
- <ol start="{{ frame.pre_context_lineno }}" class="pre-context" id="pre{{ frame.id }}">{% for line in frame.pre_context %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endfor %}</ol>
+ <ol start="{{ frame.pre_context_lineno }}" class="pre-context" id="pre{{ frame.id }}">{% for line in frame.pre_context %}{% if line %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endif %}{% endfor %}</ol>
{% endif %}
<ol start="{{ frame.lineno }}" class="context-line"><li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ frame.context_line|escape }} <span>...</span></li></ol>
{% if frame.post_context %}
- <ol start='{{ frame.lineno|add:"1" }}' class="post-context" id="post{{ frame.id }}">{% for line in frame.post_context %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endfor %}</ol>
+ <ol start='{{ frame.lineno|add:"1" }}' class="post-context" id="post{{ frame.id }}">{% for line in frame.post_context %}{% if line %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endif %}{% endfor %}</ol>
{% endif %}
</div>
{% endif %}
View
2 docs/api_stability.txt
@@ -88,7 +88,7 @@ change:
API changes may be necessary.
- Generic relations will most likely be moved out of core and into the
- content-types contrib package to avoid core dependancies on optional
+ content-types contrib package to avoid core dependencies on optional
components.
- The comments framework, which is yet undocumented, will likely get a complete
View
4 docs/contenttypes.txt
@@ -215,7 +215,7 @@ each ``TaggedItem`` will have a ``content_object`` field that returns the
object it's related to, and you can also assign to that field or use it when
creating a ``TaggedItem``::
- >>> from django.contrib.models.auth import User
+ >>> from django.contrib.auth.models import User
>>> guido = User.objects.get(username='Guido')
>>> t = TaggedItem(content_object=guido, tag='bdfl')
>>> t.save()
@@ -235,7 +235,7 @@ a "reverse" generic relationship to enable an additional API. For example::
``Bookmark`` instances will each have a ``tags`` attribute, which can
be used to retrieve their associated ``TaggedItems``::
- >>> b = Bookmark('http://www.djangoproject.com/')
+ >>> b = Bookmark(url='http://www.djangoproject.com/')
>>> b.save()
>>> t1 = TaggedItem(content_object=b, tag='django')
>>> t1.save()
View
2 docs/distributions.txt
@@ -5,7 +5,7 @@ Third-party distributions of Django
Several third-party distributors are now providing versions of Django integrated
with their package-management systems. These can make installation and upgrading
much easier for users of Django since the integration includes the ability to
-automatically install dependancies (like database adapters) that Django
+automatically install dependencies (like database adapters) that Django
requires.
Typically, these packages are based on the latest stable release of Django, so
View
6 docs/django-admin.txt
@@ -717,7 +717,7 @@ in Python package syntax, e.g. ``mysite.settings``. If this isn't provided,
variable.
Note that this option is unnecessary in ``manage.py``, because it uses
-``settings.py`` from the current project by default.
+``settings.py`` from the current project by default.
Extra niceties
==============
@@ -765,9 +765,9 @@ a command that can be executed as an action when you run ``manage.py``::
__init__.py
explode.py
views.py
-
+
In this example, the ``explode`` command will be made available to any project
-that includes the ``fancy_blog`` application in ``settings.INSTALLED_APPS``.
+that includes the ``blog`` application in ``settings.INSTALLED_APPS``.
The ``explode.py`` module has only one requirement -- it must define a class
called ``Command`` that extends ``django.core.management.base.BaseCommand``.
View
8 docs/i18n.txt
@@ -292,6 +292,14 @@ translation string. Example::
In this case, both the tag and the filter will see the already-translated
string, so they don't need to be aware of translations.
+.. note::
+ In this example, the translation infrastructure will be passed the string
+ ``"yes,no"``, not the individual strings ``"yes"`` and ``"no"``. The
+ translated string will need to contain the comma so that the filter
+ parsing code knows how to split up the arguments. For example, a German
+ translator might translate the string ``"yes,no"`` as ``"ja,nein"``
+ (keeping the comma intact).
+
.. _Django templates: ../templates_python/
Working with lazy translation objects
View
2 docs/install.txt
@@ -138,7 +138,7 @@ Installing a distribution-specific package
Check the `distribution specific notes`_ to see if your
platform/distribution provides official Django packages/installers.
Distribution-provided packages will typically allow for automatic
-installation of dependancies and easy upgrade paths.
+installation of dependencies and easy upgrade paths.
Installing an official release
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
View
19 docs/localflavor.txt
@@ -113,10 +113,23 @@ postal code or a CPA_.
.. _CPA: http://www.correoargentino.com.ar/consulta_cpa/home.php
+ARDNIField
+----------
+
+A form field that validates input as a Documento Nacional de Identidad (DNI)
+number.
+
+ARCUITField
+-----------
+
+A form field that validates input as a Código Único de Identificación
+Tributaria (CUIT) number.
+
ARProvinceSelect
----------------
-A ``Select`` widget that uses a list of Argentina's provinces as its choices.
+A ``Select`` widget that uses a list of Argentina's provinces and autonomous
+cities as its choices.
Australia (``django.contrib.localflavor.au``)
=============================================
@@ -610,7 +623,7 @@ UKNationSelect
A ``Select`` widget that uses a list of UK nations as its choices.
-United States of America (``django.contrib.localflavor.us``)
+United States of America (``django.contrib.localflavor.us``)
============================================================
USPhoneNumberField
@@ -635,7 +648,7 @@ A valid SSN must obey the following rules:
USStateField
------------
-A form field that validates input as a U.S. state name or abbreviation. It
+A form field that validates input as a U.S. state name or abbreviation. It
normalizes the input to the standard two-letter postal service abbreviation
for the given state.
View
10 docs/model-api.txt
@@ -384,7 +384,7 @@ The admin represents this as an ``<input type="text">`` (a single-line input).
``IPAddressField``
~~~~~~~~~~~~~~~~~~
-An IP address, in string format (i.e. "24.124.1.30").
+An IP address, in string format (e.g. "192.0.2.30").
The admin represents this as an ``<input type="text">`` (a single-line input).
@@ -952,10 +952,10 @@ the relationship should work. All are optional:
``limit_choices_to`` See the description under ``ForeignKey`` above.
``symmetrical`` Only used in the definition of ManyToManyFields on self.
- Consider the following model:
+ Consider the following model::
- class Person(models.Model):
- friends = models.ManyToManyField("self")
+ class Person(models.Model):
+ friends = models.ManyToManyField("self")
When Django processes this model, it identifies that it has
a ``ManyToManyField`` on itself, and as a result, it