Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote-tracking branch 'core/master' into schema-alteration

Conflicts:
	django/db/models/loading.py
	django/db/models/options.py
  • Loading branch information...
commit b62e82365ad56ca930f7abb1d1dbdf9ce5a7c7c3 2 parents 6a632e0 + c64b57d
Andrew Godwin andrewgodwin authored
Showing with 9,058 additions and 2,969 deletions.
  1. +2 −0  .gitattributes
  2. +6 −0 AUTHORS
  3. +1 −1  django/__init__.py
  4. +7 −1 django/bin/daily_cleanup.py
  5. +11 −3 django/conf/__init__.py
  6. +3 −6 django/conf/global_settings.py
  7. +9 −6 django/conf/locale/__init__.py
  8. +0 −4 django/conf/locale/ca/formats.py
  9. +15 −10 django/conf/locale/cs/formats.py
  10. +0 −4 django/conf/locale/da/formats.py
  11. +0 −8 django/conf/locale/de/formats.py
  12. +0 −8 django/conf/locale/de_CH/formats.py
  13. +1 −4 django/conf/locale/en/formats.py
  14. +0 −5 django/conf/locale/en_GB/formats.py
  15. +0 −4 django/conf/locale/es/formats.py
  16. +0 −4 django/conf/locale/es_AR/formats.py
  17. +0 −3  django/conf/locale/es_MX/formats.py
  18. +0 −3  django/conf/locale/es_NI/formats.py
  19. +0 −8 django/conf/locale/fr/formats.py
  20. +1 −4 django/conf/locale/hr/formats.py
  21. +0 −4 django/conf/locale/it/formats.py
  22. +1 −4 django/conf/locale/ka/formats.py
  23. +1 −0  django/conf/locale/ko/formats.py
  24. +1 −0  django/conf/locale/lv/formats.py
  25. +0 −9 django/conf/locale/mk/formats.py
  26. +1 −4 django/conf/locale/ml/formats.py
  27. +1 −6 django/conf/locale/nb/formats.py
  28. +4 −3 django/conf/locale/nl/formats.py
  29. +1 −5 django/conf/locale/nn/formats.py
  30. +1 −8 django/conf/locale/pl/formats.py
  31. +1 −4 django/conf/locale/pt/formats.py
  32. +1 −8 django/conf/locale/pt_BR/formats.py
  33. +0 −8 django/conf/locale/ru/formats.py
  34. +1 −8 django/conf/locale/sk/formats.py
  35. +0 −5 django/conf/locale/sl/formats.py
  36. +0 −8 django/conf/locale/sr/formats.py
  37. +0 −8 django/conf/locale/sr_Latn/formats.py
  38. +1 −4 django/conf/locale/sv/formats.py
  39. +1 −8 django/conf/locale/tr/formats.py
  40. +2 −2 django/conf/project_template/project_name/settings.py
  41. +2 −2 django/contrib/admin/filters.py
  42. +8 −4 django/contrib/admin/forms.py
  43. +1 −3 django/contrib/admin/helpers.py
  44. +8 −5 django/contrib/admin/models.py
  45. +32 −9 django/contrib/admin/options.py
  46. +7 −3 django/contrib/admin/sites.py
  47. +4 −0 django/contrib/admin/static/admin/css/base.css
  48. +5 −0 django/contrib/admin/static/admin/css/rtl.css
  49. +15 −0 django/contrib/admin/static/admin/css/widgets.css
  50. +0 −137 django/contrib/admin/static/admin/js/admin/ordering.js
  51. +0 −167 django/contrib/admin/static/admin/js/getElementsBySelector.js
  52. +2 −2 django/contrib/admin/templates/admin/auth/user/change_password.html
  53. +1 −1  django/contrib/admin/templates/admin/change_form.html
  54. +1 −1  django/contrib/admin/templates/admin/edit_inline/tabular.html
  55. +1 −1  django/contrib/admin/templates/admin/includes/fieldset.html
  56. +2 −2 django/contrib/admin/templates/admin/index.html
  57. +4 −4 django/contrib/admin/templates/admin/submit_line.html
  58. +0 −2  django/contrib/admin/templatetags/admin_modify.py
  59. +0 −15 django/contrib/admin/templatetags/adminmedia.py
  60. +14 −1 django/contrib/admin/widgets.py
  61. +2 −1  django/contrib/admindocs/views.py
  62. +6 −3 django/contrib/auth/__init__.py
  63. +4 −4 django/contrib/auth/admin.py
  64. +3 −1 django/contrib/auth/context_processors.py
  65. +18 −9 django/contrib/auth/forms.py
  66. +1 −6 django/contrib/auth/handlers/modwsgi.py
  67. +13 −7 django/contrib/auth/management/__init__.py
  68. +14 −3 django/contrib/auth/middleware.py
  69. +86 −74 django/contrib/auth/models.py
  70. +13 −0 django/contrib/auth/tests/__init__.py
  71. +74 −13 django/contrib/auth/tests/auth_backends.py
  72. +2 −0  django/contrib/auth/tests/basic.py
  73. +2 −1  django/contrib/auth/tests/context_processors.py
  74. +57 −1 django/contrib/auth/tests/custom_user.py
  75. +25 −3 django/contrib/auth/tests/forms.py
  76. +32 −11 django/contrib/auth/tests/handlers.py
  77. +34 −0 django/contrib/auth/tests/models.py
  78. +23 −2 django/contrib/auth/tests/remote_user.py
  79. +1 −1  django/contrib/auth/tests/templates/context_processors/auth_attrs_user.html
  80. +9 −2 django/contrib/auth/tests/views.py
  81. +1 −1  django/contrib/auth/tokens.py
  82. +24 −30 django/contrib/auth/views.py
  83. +2 −2 django/contrib/comments/__init__.py
  84. +1 −1  django/contrib/comments/signals.py
  85. +3 −5 django/contrib/comments/views/comments.py
  86. +6 −4 django/contrib/comments/views/moderation.py
  87. +9 −8 django/contrib/comments/views/utils.py
  88. +13 −25 django/contrib/contenttypes/generic.py
  89. +12 −4 django/contrib/contenttypes/management.py
  90. +2 −2 django/contrib/flatpages/forms.py
  91. +3 −2 django/contrib/formtools/tests/__init__.py
  92. +12 −7 django/contrib/formtools/tests/wizard/wizardtests/tests.py
  93. +6 −2 django/contrib/formtools/wizard/storage/base.py
  94. +8 −6 django/contrib/formtools/wizard/views.py
  95. +1 −23 django/contrib/gis/db/backends/oracle/compiler.py
  96. +9 −0 django/contrib/gis/db/backends/oracle/operations.py
  97. +27 −2 django/contrib/gis/db/backends/postgis/creation.py
  98. +20 −26 django/contrib/gis/db/backends/spatialite/base.py
  99. +4 −2 django/contrib/gis/db/models/query.py
  100. +4 −4 django/contrib/gis/db/models/sql/compiler.py
  101. +1 −0  django/contrib/gis/geoip/tests.py
  102. +2 −1  django/contrib/gis/geometry/test_data.py
  103. +13 −10 django/contrib/gis/geos/mutable_list.py
  104. +15 −0 django/contrib/gis/geos/tests/test_geos.py
  105. +9 −0 django/contrib/gis/geos/tests/test_mutable_list.py
  106. +12 −4 django/contrib/gis/measure.py
  107. +2 −1  django/contrib/gis/tests/geo3d/tests.py
  108. +2 −1  django/contrib/gis/tests/geogapp/tests.py
  109. +2 −1  django/contrib/gis/tests/layermap/tests.py
  110. +1 −1  django/contrib/gis/tests/utils.py
  111. +1 −1  django/contrib/gis/utils/ogrinspect.py
  112. +11 −2 django/contrib/humanize/tests.py
  113. +4 −3 django/contrib/localflavor/ar/forms.py
  114. +42 −0 django/contrib/redirects/tests.py
  115. +53 −14 django/contrib/sessions/backends/base.py
  116. +10 −3 django/contrib/sessions/backends/cache.py
  117. +21 −4 django/contrib/sessions/backends/cached_db.py
  118. +6 −1 django/contrib/sessions/backends/db.py
  119. +60 −15 django/contrib/sessions/backends/file.py
  120. +5 −0 django/contrib/sessions/backends/signed_cookies.py
  121. 0  {tests/regressiontests/pagination_regress → django/contrib/sessions/management}/__init__.py
  122. 0  {tests/modeltests/pagination → django/contrib/sessions/management/commands}/__init__.py
  123. +15 −0 django/contrib/sessions/management/commands/clearsessions.py
  124. +137 −24 django/contrib/sessions/tests.py
  125. +3 −2 django/contrib/sitemaps/tests/http.py
  126. +2 −1  django/contrib/staticfiles/storage.py
  127. +3 −7 django/core/cache/__init__.py
  128. +11 −1 django/core/cache/backends/base.py
  129. +8 −4 django/core/cache/backends/db.py
  130. +6 −0 django/core/cache/backends/memcached.py
  131. +12 −5 django/core/files/base.py
  132. +1 −1  django/core/handlers/base.py
  133. +24 −0 django/core/handlers/wsgi.py
  134. +4 −1 django/core/mail/backends/smtp.py
  135. +10 −8 django/core/management/__init__.py
  136. +8 −8 django/core/management/commands/cleanup.py
  137. +3 −2 django/core/management/commands/compilemessages.py
  138. +143 −135 django/core/management/commands/loaddata.py
  139. +3 −3 django/core/management/commands/makemessages.py
  140. +7 −6 django/core/management/sql.py
  141. +4 −4 django/core/management/templates.py
  142. +39 −21 django/core/management/validation.py
  143. +39 −38 django/core/paginator.py
  144. +1 −3 django/core/serializers/base.py
  145. +0 −2  django/core/serializers/xml_serializer.py
  146. +4 −0 django/core/servers/basehttp.py
  147. +10 −6 django/core/signing.py
  148. +8 −6 django/core/urlresolvers.py
  149. +1 −1  django/db/__init__.py
  150. +8 −7 django/db/backends/__init__.py
  151. +33 −19 django/db/backends/creation.py
  152. +45 −37 django/db/backends/mysql/base.py
  153. +74 −60 django/db/backends/oracle/base.py
  154. +6 −4 django/db/backends/oracle/creation.py
  155. +51 −40 django/db/backends/postgresql_psycopg2/base.py
  156. +24 −8 django/db/backends/sqlite3/base.py
  157. +3 −5 django/db/backends/util.py
  158. +5 −0 django/db/models/base.py
  159. +8 −4 django/db/models/expressions.py
  160. +46 −28 django/db/models/fields/related.py
  161. +15 −5 django/db/models/loading.py
  162. +14 −46 django/db/models/options.py
  163. +72 −45 django/db/models/query.py
  164. +9 −8 django/db/models/signals.py
  165. +79 −112 django/db/models/sql/compiler.py
  166. +15 −2 django/db/models/sql/constants.py
  167. +8 −5 django/db/models/sql/expressions.py
  168. +378 −404 django/db/models/sql/query.py
  169. +2 −2 django/db/models/sql/subqueries.py
  170. +10 −2 django/db/utils.py
  171. +51 −22 django/dispatch/dispatcher.py
  172. +9 −7 django/dispatch/saferef.py
  173. +5 −4 django/forms/formsets.py
  174. +1 −1  django/forms/models.py
  175. +2 −2 django/forms/widgets.py
  176. +11 −13 django/http/multipartparser.py
  177. +5 −1 django/http/request.py
  178. +1 −3 django/http/response.py
  179. +0 −1  django/middleware/cache.py
  180. +12 −1 django/middleware/common.py
  181. +10 −2 django/shortcuts/__init__.py
  182. +1 −1  django/template/defaultfilters.py
  183. +11 −2 django/template/defaulttags.py
  184. +1 −1  django/template/response.py
  185. +7 −0 django/test/signals.py
  186. +63 −53 django/test/testcases.py
  187. +6 −2 django/test/utils.py
  188. +22 −1 django/utils/_os.py
  189. +38 −4 django/utils/autoreload.py
  190. +14 −19 django/utils/datastructures.py
  191. +1 −1  django/utils/encoding.py
  192. +16 −0 django/utils/formats.py
  193. +5 −5 django/utils/functional.py
  194. +12 −7 django/utils/html.py
  195. +12 −0 django/utils/http.py
  196. +13 −3 django/utils/log.py
  197. +6 −4 django/utils/translation/trans_real.py
  198. +3 −1 django/utils/tree.py
  199. +6 −5 django/views/generic/base.py
  200. +3 −1 django/views/generic/edit.py
  201. +23 −7 django/views/generic/list.py
  202. +12 −10 django/views/i18n.py
  203. +6 −0 docs/Makefile
  204. +3 −2 docs/_theme/djangodocs/static/djangodocs.css
  205. BIN  docs/_theme/djangodocs/static/docicons-warning.png
  206. +30 −5 docs/conf.py
  207. +13 −10 docs/faq/admin.txt
  208. +1 −1  docs/faq/general.txt
  209. +4 −4 docs/faq/install.txt
  210. +36 −1 docs/faq/troubleshooting.txt
  211. +8 −11 docs/howto/custom-file-storage.txt
  212. +12 −4 docs/howto/deployment/wsgi/modwsgi.txt
  213. +6 −1 docs/index.txt
  214. +7 −0 docs/internals/contributing/writing-code/submitting-patches.txt
  215. +6 −1 docs/internals/contributing/writing-code/unit-tests.txt
  216. +13 −4 docs/internals/deprecation.txt
  217. +580 −0 docs/intro/contributing.txt
  218. +9 −6 docs/intro/index.txt
  219. +1 −2  docs/intro/overview.txt
  220. +365 −0 docs/intro/reusable-apps.txt
  221. +11 −27 docs/intro/tutorial01.txt
  222. +0 −5 docs/intro/tutorial02.txt
  223. +10 −4 docs/intro/tutorial03.txt
  224. +2 −5 docs/intro/tutorial04.txt
  225. +650 −0 docs/intro/tutorial05.txt
  226. +9 −0 docs/make.bat
  227. +0 −3  docs/misc/design-philosophies.txt
  228. +7 −0 docs/ref/class-based-views/flattened-index.txt
  229. +297 −2 docs/ref/class-based-views/generic-date-based.txt
  230. +3 −4 docs/ref/class-based-views/generic-editing.txt
  231. +3 −2 docs/ref/class-based-views/index.txt
  232. +29 −2 docs/ref/class-based-views/mixins-multiple-object.txt
  233. +9 −0 docs/ref/contrib/admin/actions.txt
  234. +87 −14 docs/ref/contrib/admin/index.txt
  235. +1 −8 docs/ref/contrib/comments/index.txt
  236. +2 −2 docs/ref/contrib/comments/signals.txt
  237. +0 −78 docs/ref/contrib/comments/upgrade.txt
  238. +30 −2 docs/ref/contrib/formtools/form-wizard.txt
  239. +11 −0 docs/ref/contrib/gis/geos.txt
  240. +1 −1  docs/ref/contrib/gis/install/index.txt
  241. +136 −145 docs/ref/contrib/gis/tutorial.txt
  242. +1 −1  docs/ref/contrib/messages.txt
  243. +22 −7 docs/ref/contrib/sites.txt
  244. +5 −0 docs/ref/contrib/syndication.txt
  245. +5 −0 docs/ref/databases.txt
  246. +39 −3 docs/ref/django-admin.txt
  247. +1 −1  docs/ref/forms/fields.txt
  248. +129 −63 docs/ref/forms/widgets.txt
  249. +6 −1 docs/ref/models/fields.txt
  250. +51 −36 docs/ref/models/instances.txt
  251. +15 −0 docs/ref/models/options.txt
  252. +22 −18 docs/ref/models/querysets.txt
  253. +41 −26 docs/ref/settings.txt
  254. +64 −6 docs/ref/templates/builtins.txt
  255. +4 −4 docs/ref/unicode.txt
  256. +9 −17 docs/ref/urlresolvers.txt
  257. +12 −0 docs/ref/utils.txt
  258. +2 −2 docs/releases/1.0-beta-2.txt
  259. +2 −2 docs/releases/1.0-porting-guide.txt
  260. +2 −2 docs/releases/1.0.txt
  261. +12 −12 docs/releases/1.5-alpha-1.txt
  262. +702 −0 docs/releases/1.5-beta-1.txt
  263. +96 −4 docs/releases/1.5.txt
  264. +43 −0 docs/releases/1.6.txt
  265. +8 −0 docs/releases/index.txt
  266. +883 −0 docs/topics/_images/django_unittest_classes_hierarchy.graffle
  267. BIN  docs/topics/_images/django_unittest_classes_hierarchy.pdf
  268. BIN  docs/topics/_images/django_unittest_classes_hierarchy.png
  269. +3 −0  docs/topics/_images/django_unittest_classes_hierarchy.svg
  270. +158 −5 docs/topics/auth.txt
  271. +10 −0 docs/topics/cache.txt
  272. +6 −6 docs/topics/class-based-views/generic-editing.txt
  273. +11 −9 docs/topics/class-based-views/index.txt
  274. +15 −0 docs/topics/db/managers.txt
  275. +4 −3 docs/topics/db/models.txt
  276. +46 −0 docs/topics/db/multi-db.txt
  277. +35 −0 docs/topics/db/optimization.txt
  278. +13 −8 docs/topics/db/queries.txt
  279. +9 −3 docs/topics/db/transactions.txt
  280. +2 −0  docs/topics/files.txt
  281. +9 −6 docs/topics/forms/modelforms.txt
  282. +957 −0 docs/topics/http/_images/middleware.graffle
  283. BIN  docs/topics/http/_images/middleware.pdf
  284. BIN  docs/topics/http/_images/middleware.png
  285. +3 −0  docs/topics/http/_images/middleware.svg
  286. +119 −72 docs/topics/http/middleware.txt
  287. +43 −9 docs/topics/http/sessions.txt
  288. +1 −1  docs/topics/http/shortcuts.txt
  289. +7 −8 docs/topics/http/urls.txt
  290. +11 −0 docs/topics/http/views.txt
  291. +18 −16 docs/topics/install.txt
  292. +20 −3 docs/topics/logging.txt
  293. +7 −6 docs/topics/python3.txt
  294. +25 −0 docs/topics/security.txt
  295. +0 −9 docs/topics/serialization.txt
  296. +3 −3 docs/topics/templates.txt
  297. +38 −11 docs/topics/testing.txt
  298. +35 −1 tests/modeltests/basic/tests.py
  299. +42 −1 tests/modeltests/expressions/tests.py
  300. +2 −1  tests/modeltests/field_subclassing/tests.py
Sorry, we could not display the entire diff because too many files (438) changed.
2  .gitattributes
View
@@ -0,0 +1,2 @@
+# Normalize line endings to avoid spurious failures in the core test suite on Windows.
+*html text eol=lf
6 AUTHORS
View
@@ -91,6 +91,7 @@ answer newbie questions, and generally made Django that much better:
James Bennett
Danilo Bargen
Shai Berger <shai@platonix.com>
+ berto
Julian Bez
Arvis Bickovskis <viestards.lists@gmail.com>
Natalia Bidart <nataliabidart@gmail.com>
@@ -231,6 +232,7 @@ answer newbie questions, and generally made Django that much better:
Simon Greenhill <dev@simon.net.nz>
Owen Griffiths
Espen Grindhaug <http://grindhaug.org/>
+ Mike Grouchy <http://mikegrouchy.com/>
Janos Guljas
Thomas Güttler <hv@tbz-pariv.de>
Horst Gutmann <zerok@zerokspot.com>
@@ -380,6 +382,7 @@ answer newbie questions, and generally made Django that much better:
Christian Metts
michal@plovarna.cz
Slawek Mikula <slawek dot mikula at gmail dot com>
+ Katie Miller <katie@sub50.com>
Shawn Milochik <shawn@milochik.com>
mitakummaa@gmail.com
Taylor Mitchell <taylor.mitchell@gmail.com>
@@ -510,6 +513,7 @@ answer newbie questions, and generally made Django that much better:
Johan C. Stöver <johan@nilling.nl>
Nowell Strite <http://nowell.strite.org/>
Thomas Stromberg <tstromberg@google.com>
+ Ben Sturmfels <ben@sturm.com.au>
Travis Swicegood <travis@domain51.com>
Pascal Varet
SuperJared
@@ -528,6 +532,7 @@ answer newbie questions, and generally made Django that much better:
Terry Huang <terryh.tp@gmail.com>
Travis Terry <tdterry7@gmail.com>
thebjorn <bp@datakortet.no>
+ Lowe Thiderman <lowe.thiderman@gmail.com>
Zach Thompson <zthompson47@gmail.com>
Michael Thornhill <michael.thornhill@gmail.com>
Deepak Thukral <deep.thukral@gmail.com>
@@ -585,6 +590,7 @@ answer newbie questions, and generally made Django that much better:
Gasper Zejn <zejn@kiberpipa.org>
Jarek Zgoda <jarek.zgoda@gmail.com>
Cheng Zhang
+ Hannes Struß <x@hannesstruss.de>
A big THANK YOU goes to:
2  django/__init__.py
View
@@ -1,4 +1,4 @@
-VERSION = (1, 5, 0, 'alpha', 0)
+VERSION = (1, 6, 0, 'alpha', 0)
def get_version(*args, **kwargs):
# Don't litter django/__init__.py with all the get_version stuff.
8 django/bin/daily_cleanup.py
View
@@ -7,7 +7,13 @@
sessions at the moment).
"""
+import warnings
+
from django.core import management
if __name__ == "__main__":
- management.call_command('cleanup')
+ warnings.warn(
+ "The `daily_cleanup` script has been deprecated "
+ "in favor of `django-admin.py clearsessions`.",
+ PendingDeprecationWarning)
+ management.call_command('clearsessions')
14 django/conf/__init__.py
View
@@ -6,6 +6,7 @@
a list of all possible variables.
"""
+import logging
import os
import time # Needed for Windows
import warnings
@@ -55,6 +56,15 @@ def _configure_logging(self):
"""
Setup logging from LOGGING_CONFIG and LOGGING settings.
"""
+ try:
+ # Route warnings through python logging
+ logging.captureWarnings(True)
+ # Allow DeprecationWarnings through the warnings filters
+ warnings.simplefilter("default", DeprecationWarning)
+ except AttributeError:
+ # No captureWarnings on Python 2.6, DeprecationWarnings are on anyway
+ pass
+
if self.LOGGING_CONFIG:
from django.utils.log import DEFAULT_LOGGING
# First find the logging configuration function ...
@@ -83,6 +93,7 @@ def configure(self, default_settings=global_settings, **options):
for name, value in options.items():
setattr(holder, name, value)
self._wrapped = holder
+ self._configure_logging()
@property
def configured(self):
@@ -99,9 +110,6 @@ class BaseSettings(object):
def __setattr__(self, name, value):
if name in ("MEDIA_URL", "STATIC_URL") and value and not value.endswith('/'):
raise ImproperlyConfigured("If set, %s must end with a slash" % name)
- elif name == "ADMIN_MEDIA_PREFIX":
- warnings.warn("The ADMIN_MEDIA_PREFIX setting has been removed; "
- "use STATIC_URL instead.", DeprecationWarning)
elif name == "ALLOWED_INCLUDE_ROOTS" and isinstance(value, six.string_types):
raise ValueError("The ALLOWED_INCLUDE_ROOTS setting must be set "
"to a tuple, not a string.")
9 django/conf/global_settings.py
View
@@ -150,12 +150,8 @@
# Whether to send broken-link emails.
SEND_BROKEN_LINK_EMAILS = False
-# Database connection info.
-DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.dummy',
- },
-}
+# Database connection info. If left empty, will default to the dummy backend.
+DATABASES = {}
# Classes used to implement DB routing behavior.
DATABASE_ROUTERS = []
@@ -449,6 +445,7 @@
# SESSIONS #
############
+SESSION_CACHE_ALIAS = 'default' # Cache to store session data if using the cache session backend.
SESSION_COOKIE_NAME = 'sessionid' # Cookie name. This can be whatever you want.
SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2 # Age of cookie, in seconds (default: 2 weeks).
SESSION_COOKIE_DOMAIN = None # A string like ".example.com", or None for standard domain cookie.
15 django/conf/locale/__init__.py
View
@@ -1,5 +1,8 @@
from __future__ import unicode_literals
+# About name_local: capitalize it as if your language name was appearing
+# inside a sentence in your language.
+
LANG_INFO = {
'ar': {
'bidi': True,
@@ -53,7 +56,7 @@
'bidi': False,
'code': 'da',
'name': 'Danish',
- 'name_local': 'Dansk',
+ 'name_local': 'dansk',
},
'de': {
'bidi': False,
@@ -137,7 +140,7 @@
'bidi': False,
'code': 'fr',
'name': 'French',
- 'name_local': 'Fran\xe7ais',
+ 'name_local': 'fran\xe7ais',
},
'fy-nl': {
'bidi': False,
@@ -269,7 +272,7 @@
'bidi': False,
'code': 'nb',
'name': 'Norwegian Bokmal',
- 'name_local': 'Norsk (bokm\xe5l)',
+ 'name_local': 'norsk (bokm\xe5l)',
},
'ne': {
'bidi': False,
@@ -287,13 +290,13 @@
'bidi': False,
'code': 'nn',
'name': 'Norwegian Nynorsk',
- 'name_local': 'Norsk (nynorsk)',
+ 'name_local': 'norsk (nynorsk)',
},
'no': {
'bidi': False,
'code': 'no',
'name': 'Norwegian',
- 'name_local': 'Norsk',
+ 'name_local': 'norsk',
},
'pa': {
'bidi': False,
@@ -365,7 +368,7 @@
'bidi': False,
'code': 'sv',
'name': 'Swedish',
- 'name_local': 'Svenska',
+ 'name_local': 'svenska',
},
'sw': {
'bidi': False,
4 django/conf/locale/ca/formats.py
View
@@ -19,10 +19,6 @@
# '31/12/2009', '31/12/09'
'%d/%m/%Y', '%d/%m/%y'
)
-TIME_INPUT_FORMATS = (
- # '14:30:59', '14:30'
- '%H:%M:%S', '%H:%M'
-)
DATETIME_INPUT_FORMATS = (
'%d/%m/%Y %H:%M:%S',
'%d/%m/%Y %H:%M',
25 django/conf/locale/cs/formats.py
View
@@ -17,21 +17,26 @@
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_INPUT_FORMATS = (
- '%d.%m.%Y', '%d.%m.%y', # '25.10.2006', '25.10.06'
- '%Y-%m-%d', '%y-%m-%d', # '2006-10-25', '06-10-25'
+ '%d.%m.%Y', '%d.%m.%y', # '05.01.2006', '05.01.06'
+ '%d. %m. %Y', '%d. %m. %y', # '5. 1. 2006', '5. 1. 06'
# '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006'
)
+# Kept ISO formats as one is in first position
TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
+ '%H:%M:%S', # '04:30:59'
+ '%H.%M', # '04.30'
+ '%H:%M', # '04:30'
)
DATETIME_INPUT_FORMATS = (
- '%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59'
- '%d.%m.%Y %H:%M', # '25.10.2006 14:30'
- '%d.%m.%Y', # '25.10.2006'
- '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
- '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
- '%Y-%m-%d', # '2006-10-25'
+ '%d.%m.%Y %H:%M:%S', # '05.01.2006 04:30:59'
+ '%d.%m.%Y %H.%M', # '05.01.2006 04.30'
+ '%d.%m.%Y %H:%M', # '05.01.2006 04:30'
+ '%d.%m.%Y', # '05.01.2006'
+ '%d. %m. %Y %H:%M:%S', # '05. 01. 2006 04:30:59'
+ '%d. %m. %Y %H.%M', # '05. 01. 2006 04.30'
+ '%d. %m. %Y %H:%M', # '05. 01. 2006 04:30'
+ '%d. %m. %Y', # '05. 01. 2006'
+ '%Y-%m-%d %H.%M', # '2006-01-05 04.30'
)
DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '\xa0' # non-breaking space
4 django/conf/locale/da/formats.py
View
@@ -18,10 +18,6 @@
DATE_INPUT_FORMATS = (
'%d.%m.%Y', # '25.10.2006'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59'
'%d.%m.%Y %H:%M', # '25.10.2006 14:30'
8 django/conf/locale/de/formats.py
View
@@ -17,20 +17,12 @@
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_INPUT_FORMATS = (
'%d.%m.%Y', '%d.%m.%y', # '25.10.2006', '25.10.06'
- '%Y-%m-%d', '%y-%m-%d', # '2006-10-25', '06-10-25'
# '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59'
'%d.%m.%Y %H:%M', # '25.10.2006 14:30'
'%d.%m.%Y', # '25.10.2006'
- '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
- '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
- '%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '.'
8 django/conf/locale/de_CH/formats.py
View
@@ -19,20 +19,12 @@
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_INPUT_FORMATS = (
'%d.%m.%Y', '%d.%m.%y', # '25.10.2006', '25.10.06'
- '%Y-%m-%d', '%y-%m-%d', # '2006-10-25', '06-10-25'
# '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59'
'%d.%m.%Y %H:%M', # '25.10.2006 14:30'
'%d.%m.%Y', # '25.10.2006'
- '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
- '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
- '%Y-%m-%d', # '2006-10-25'
)
# these are the separators for non-monetary numbers. For monetary numbers,
5 django/conf/locale/en/formats.py
View
@@ -15,6 +15,7 @@
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
+# Kept ISO formats as they are in first position
DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
# '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
@@ -22,10 +23,6 @@
# '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006'
# '%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
'%Y-%m-%d %H:%M', # '2006-10-25 14:30'
5 django/conf/locale/en_GB/formats.py
View
@@ -17,16 +17,11 @@
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_INPUT_FORMATS = (
'%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06'
- '%Y-%m-%d', # '2006-10-25'
# '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
# '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'
# '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006'
# '%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
'%Y-%m-%d %H:%M', # '2006-10-25 14:30'
4 django/conf/locale/es/formats.py
View
@@ -19,10 +19,6 @@
# '31/12/2009', '31/12/09'
'%d/%m/%Y', '%d/%m/%y'
)
-TIME_INPUT_FORMATS = (
- # '14:30:59', '14:30'
- '%H:%M:%S', '%H:%M'
-)
DATETIME_INPUT_FORMATS = (
'%d/%m/%Y %H:%M:%S',
'%d/%m/%Y %H:%M',
4 django/conf/locale/es_AR/formats.py
View
@@ -19,10 +19,6 @@
'%d/%m/%Y', # '31/12/2009'
'%d/%m/%y', # '31/12/09'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%d/%m/%Y %H:%M:%S',
'%d/%m/%Y %H:%M',
3  django/conf/locale/es_MX/formats.py
View
@@ -15,9 +15,6 @@
'%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06'
'%Y%m%d', # '20061025'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', '%H:%M', # '14:30:59', '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%d/%m/%Y %H:%M:%S',
'%d/%m/%Y %H:%M',
3  django/conf/locale/es_NI/formats.py
View
@@ -15,9 +15,6 @@
'%Y%m%d', # '20061025'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', '%H:%M', # '14:30:59', '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%d/%m/%Y %H:%M:%S',
'%d/%m/%Y %H:%M',
8 django/conf/locale/fr/formats.py
View
@@ -19,13 +19,8 @@
DATE_INPUT_FORMATS = (
'%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06'
'%d.%m.%Y', '%d.%m.%y', # Swiss (fr_CH), '25.10.2006', '25.10.06'
- '%Y-%m-%d', '%y-%m-%d', # '2006-10-25', '06-10-25'
# '%d %B %Y', '%d %b %Y', # '25 octobre 2006', '25 oct. 2006'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%d/%m/%Y %H:%M:%S', # '25/10/2006 14:30:59'
'%d/%m/%Y %H:%M', # '25/10/2006 14:30'
@@ -33,9 +28,6 @@
'%d.%m.%Y %H:%M:%S', # Swiss (fr_CH), '25.10.2006 14:30:59'
'%d.%m.%Y %H:%M', # Swiss (fr_CH), '25.10.2006 14:30'
'%d.%m.%Y', # Swiss (fr_CH), '25.10.2006'
- '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
- '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
- '%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '\xa0' # non-breaking space
5 django/conf/locale/hr/formats.py
View
@@ -15,15 +15,12 @@
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
+# Kept ISO formats as they are in first position
DATE_INPUT_FORMATS = (
'%Y-%m-%d', # '2006-10-25'
'%d.%m.%Y.', '%d.%m.%y.', # '25.10.2006.', '25.10.06.'
'%d. %m. %Y.', '%d. %m. %y.', # '25. 10. 2006.', '25. 10. 06.'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
'%Y-%m-%d %H:%M', # '2006-10-25 14:30'
4 django/conf/locale/it/formats.py
View
@@ -20,10 +20,6 @@
'%d-%m-%Y', '%Y-%m-%d', # '25-10-2006', '2008-10-25'
'%d-%m-%y', '%d/%m/%y', # '25-10-06', '25/10/06'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%d/%m/%Y %H:%M:%S', # '25/10/2006 14:30:59'
'%d/%m/%Y %H:%M', # '25/10/2006 14:30'
5 django/conf/locale/ka/formats.py
View
@@ -15,16 +15,13 @@
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
+# Kept ISO formats as they are in first position
DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
# '%d %b %Y', '%d %b, %Y', '%d %b. %Y', # '25 Oct 2006', '25 Oct, 2006', '25 Oct. 2006'
# '%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006'
# '%d.%m.%Y', '%d.%m.%y', # '25.10.2006', '25.10.06'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
'%Y-%m-%d %H:%M', # '2006-10-25 14:30'
1  django/conf/locale/ko/formats.py
View
@@ -16,6 +16,7 @@
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
+# Kept ISO formats as they are in first position
DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
# '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
1  django/conf/locale/lv/formats.py
View
@@ -16,6 +16,7 @@
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
+# Kept ISO formats as they are in first position
DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06'
)
9 django/conf/locale/mk/formats.py
View
@@ -18,12 +18,6 @@
DATE_INPUT_FORMATS = (
'%d.%m.%Y.', '%d.%m.%y.', # '25.10.2006.', '25.10.06.'
'%d. %m. %Y.', '%d. %m. %y.', # '25. 10. 2006.', '25. 10. 06.'
- '%Y-%m-%d', # '2006-10-25'
-)
-
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
)
DATETIME_INPUT_FORMATS = (
@@ -39,9 +33,6 @@
'%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59'
'%d. %m. %y. %H:%M', # '25. 10. 06. 14:30'
'%d. %m. %y.', # '25. 10. 06.'
- '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
- '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
- '%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
5 django/conf/locale/ml/formats.py
View
@@ -15,6 +15,7 @@
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
+# Kept ISO formats as they are in first position
DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
# '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
@@ -22,10 +23,6 @@
# '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006'
# '%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
'%Y-%m-%d %H:%M', # '2006-10-25 14:30'
7 django/conf/locale/nb/formats.py
View
@@ -16,22 +16,17 @@
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
+# Kept ISO formats as they are in first position
DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06'
- '%Y-%m-%d', # '2006-10-25',
# '%d. %b %Y', '%d %b %Y', # '25. okt 2006', '25 okt 2006'
# '%d. %b. %Y', '%d %b. %Y', # '25. okt. 2006', '25 okt. 2006'
# '%d. %B %Y', '%d %B %Y', # '25. oktober 2006', '25 oktober 2006'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
'%Y-%m-%d %H:%M', # '2006-10-25 14:30'
'%Y-%m-%d', # '2006-10-25'
- '%Y-%m-%d', # '2006-10-25'
'%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59'
'%d.%m.%Y %H:%M', # '25.10.2006 14:30'
'%d.%m.%Y', # '25.10.2006'
7 django/conf/locale/nl/formats.py
View
@@ -16,10 +16,11 @@
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_INPUT_FORMATS = (
- '%d-%m-%Y', '%d-%m-%y', '%Y-%m-%d', # '20-01-2009', '20-01-09', '2009-01-20'
- # '%d %b %Y', '%d %b %y', # '20 jan 2009', '20 jan 09'
- # '%d %B %Y', '%d %B %y', # '20 januari 2009', '20 januari 09'
+ '%d-%m-%Y', '%d-%m-%y', # '20-01-2009', '20-01-09'
+ # '%d %b %Y', '%d %b %y', # '20 jan 2009', '20 jan 09'
+ # '%d %B %Y', '%d %B %y', # '20 januari 2009', '20 januari 09'
)
+# Kept ISO formats as one is in first position
TIME_INPUT_FORMATS = (
'%H:%M:%S', # '15:23:35'
'%H.%M:%S', # '15.23:35'
6 django/conf/locale/nn/formats.py
View
@@ -16,17 +16,13 @@
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
+# Kept ISO formats as they are in first position
DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%d.%m.%Y', '%d.%m.%y', # '2006-10-25', '25.10.2006', '25.10.06'
- '%Y-%m-%d', # '2006-10-25',
# '%d. %b %Y', '%d %b %Y', # '25. okt 2006', '25 okt 2006'
# '%d. %b. %Y', '%d %b. %Y', # '25. okt. 2006', '25 okt. 2006'
# '%d. %B %Y', '%d %B %Y', # '25. oktober 2006', '25 oktober 2006'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
'%Y-%m-%d %H:%M', # '2006-10-25 14:30'
9 django/conf/locale/pl/formats.py
View
@@ -18,20 +18,13 @@
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_INPUT_FORMATS = (
'%d.%m.%Y', '%d.%m.%y', # '25.10.2006', '25.10.06'
- '%Y-%m-%d', '%y-%m-%d', # '2006-10-25', '06-10-25'
+ '%y-%m-%d', # '06-10-25'
# '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59'
'%d.%m.%Y %H:%M', # '25.10.2006 14:30'
'%d.%m.%Y', # '25.10.2006'
- '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
- '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
- '%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = ' '
5 django/conf/locale/pt/formats.py
View
@@ -15,15 +15,12 @@
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
+# Kept ISO formats as they are in first position
DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06'
# '%d de %b de %Y', '%d de %b, %Y', # '25 de Out de 2006', '25 Out, 2006'
# '%d de %B de %Y', '%d de %B, %Y', # '25 de Outubro de 2006', '25 de Outubro, 2006'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
'%Y-%m-%d %H:%M', # '2006-10-25 14:30'
9 django/conf/locale/pt_BR/formats.py
View
@@ -17,14 +17,10 @@
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_INPUT_FORMATS = (
- '%d/%m/%Y', '%d/%m/%y', '%Y-%m-%d', # '25/10/2006', '25/10/06', '2006-10-25'
+ '%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06'
# '%d de %b de %Y', '%d de %b, %Y', # '25 de Out de 2006', '25 Out, 2006'
# '%d de %B de %Y', '%d de %B, %Y', # '25 de Outubro de 2006', '25 de Outubro, 2006'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%d/%m/%Y %H:%M:%S', # '25/10/2006 14:30:59'
'%d/%m/%Y %H:%M', # '25/10/2006 14:30'
@@ -32,9 +28,6 @@
'%d/%m/%y %H:%M:%S', # '25/10/06 14:30:59'
'%d/%m/%y %H:%M', # '25/10/06 14:30'
'%d/%m/%y', # '25/10/06'
- '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
- '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
- '%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '.'
8 django/conf/locale/ru/formats.py
View
@@ -19,12 +19,7 @@
DATE_INPUT_FORMATS = (
'%d.%m.%Y', # '25.10.2006'
'%d.%m.%y', # '25.10.06'
- '%Y-%m-%d', # '2006-10-25'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59'
'%d.%m.%Y %H:%M', # '25.10.2006 14:30'
@@ -32,9 +27,6 @@
'%d.%m.%y %H:%M:%S', # '25.10.06 14:30:59'
'%d.%m.%y %H:%M', # '25.10.06 14:30'
'%d.%m.%y', # '25.10.06'
- '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
- '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
- '%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '\xa0' # non-breaking space
9 django/conf/locale/sk/formats.py
View
@@ -18,20 +18,13 @@
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_INPUT_FORMATS = (
'%d.%m.%Y', '%d.%m.%y', # '25.10.2006', '25.10.06'
- '%Y-%m-%d', '%y-%m-%d', # '2006-10-25', '06-10-25'
+ '%y-%m-%d', # '06-10-25'
# '%d. %B %Y', '%d. %b. %Y', # '25. October 2006', '25. Oct. 2006'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59'
'%d.%m.%Y %H:%M', # '25.10.2006 14:30'
'%d.%m.%Y', # '25.10.2006'
- '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
- '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
- '%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '\xa0' # non-breaking space
5 django/conf/locale/sl/formats.py
View
@@ -21,11 +21,6 @@
'%d. %m. %Y', '%d. %m. %y', # '25. 10. 2006', '25. 10. 06'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
-
DATETIME_INPUT_FORMATS = (
'%d.%m.%Y %H:%M:%S', # '25.10.2006 14:30:59'
'%d.%m.%Y %H:%M', # '25.10.2006 14:30'
8 django/conf/locale/sr/formats.py
View
@@ -18,15 +18,10 @@
DATE_INPUT_FORMATS = (
'%d.%m.%Y.', '%d.%m.%y.', # '25.10.2006.', '25.10.06.'
'%d. %m. %Y.', '%d. %m. %y.', # '25. 10. 2006.', '25. 10. 06.'
- '%Y-%m-%d', # '2006-10-25'
# '%d. %b %y.', '%d. %B %y.', # '25. Oct 06.', '25. October 06.'
# '%d. %b \'%y.', '%d. %B \'%y.', # '25. Oct '06.', '25. October '06.'
# '%d. %b %Y.', '%d. %B %Y.', # '25. Oct 2006.', '25. October 2006.'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59'
'%d.%m.%Y. %H:%M', # '25.10.2006. 14:30'
@@ -40,9 +35,6 @@
'%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59'
'%d. %m. %y. %H:%M', # '25. 10. 06. 14:30'
'%d. %m. %y.', # '25. 10. 06.'
- '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
- '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
- '%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '.'
8 django/conf/locale/sr_Latn/formats.py
View
@@ -18,15 +18,10 @@
DATE_INPUT_FORMATS = (
'%d.%m.%Y.', '%d.%m.%y.', # '25.10.2006.', '25.10.06.'
'%d. %m. %Y.', '%d. %m. %y.', # '25. 10. 2006.', '25. 10. 06.'
- '%Y-%m-%d', # '2006-10-25'
# '%d. %b %y.', '%d. %B %y.', # '25. Oct 06.', '25. October 06.'
# '%d. %b \'%y.', '%d. %B \'%y.', # '25. Oct '06.', '25. October '06.'
# '%d. %b %Y.', '%d. %B %Y.', # '25. Oct 2006.', '25. October 2006.'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%d.%m.%Y. %H:%M:%S', # '25.10.2006. 14:30:59'
'%d.%m.%Y. %H:%M', # '25.10.2006. 14:30'
@@ -40,9 +35,6 @@
'%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59'
'%d. %m. %y. %H:%M', # '25. 10. 06. 14:30'
'%d. %m. %y.', # '25. 10. 06.'
- '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
- '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
- '%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '.'
5 django/conf/locale/sv/formats.py
View
@@ -16,15 +16,12 @@
# The *_INPUT_FORMATS strings use the Python strftime format syntax,
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
+# Kept ISO formats as they are in first position
DATE_INPUT_FORMATS = (
'%Y-%m-%d', # '2006-10-25'
'%m/%d/%Y', # '10/25/2006'
'%m/%d/%y', # '10/25/06'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
'%Y-%m-%d %H:%M', # '2006-10-25 14:30'
9 django/conf/locale/tr/formats.py
View
@@ -17,20 +17,13 @@
# see http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_INPUT_FORMATS = (
'%d/%m/%Y', '%d/%m/%y', # '25/10/2006', '25/10/06'
- '%Y-%m-%d', '%y-%m-%d', # '2006-10-25', '06-10-25'
+ '%y-%m-%d', # '06-10-25'
# '%d %B %Y', '%d %b. %Y', # '25 Ekim 2006', '25 Eki. 2006'
)
-TIME_INPUT_FORMATS = (
- '%H:%M:%S', # '14:30:59'
- '%H:%M', # '14:30'
-)
DATETIME_INPUT_FORMATS = (
'%d/%m/%Y %H:%M:%S', # '25/10/2006 14:30:59'
'%d/%m/%Y %H:%M', # '25/10/2006 14:30'
'%d/%m/%Y', # '25/10/2006'
- '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
- '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
- '%Y-%m-%d', # '2006-10-25'
)
DECIMAL_SEPARATOR = ','
THOUSAND_SEPARATOR = '.'
4 django/conf/project_template/project_name/settings.py
View
@@ -75,7 +75,7 @@
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
-# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
+ # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# Make this unique, and don't share it with anybody.
@@ -85,7 +85,7 @@
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
-# 'django.template.loaders.eggs.Loader',
+ # 'django.template.loaders.eggs.Loader',
)
MIDDLEWARE_CLASSES = (
4 django/contrib/admin/filters.py
View
@@ -9,7 +9,7 @@
from django.db import models
from django.core.exceptions import ImproperlyConfigured, ValidationError
-from django.utils.encoding import smart_text
+from django.utils.encoding import smart_text, force_text
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.contrib.admin.util import (get_model_from_relation,
@@ -102,7 +102,7 @@ def choices(self, cl):
}
for lookup, title in self.lookup_choices:
yield {
- 'selected': self.value() == lookup,
+ 'selected': self.value() == force_text(lookup),
'query_string': cl.get_query_string({
self.parameter_name: lookup,
}, []),
12 django/contrib/admin/forms.py
View
@@ -6,8 +6,8 @@
from django.contrib.auth.forms import AuthenticationForm
from django.utils.translation import ugettext_lazy
-ERROR_MESSAGE = ugettext_lazy("Please enter the correct username and password "
- "for a staff account. Note that both fields are case-sensitive.")
+ERROR_MESSAGE = ugettext_lazy("Please enter the correct %(username)s and password "
+ "for a staff account. Note that both fields may be case-sensitive.")
class AdminAuthenticationForm(AuthenticationForm):
@@ -26,8 +26,12 @@ def clean(self):
if username and password:
self.user_cache = authenticate(username=username, password=password)
if self.user_cache is None:
- raise forms.ValidationError(message)
+ raise forms.ValidationError(message % {
+ 'username': self.username_field.verbose_name
+ })
elif not self.user_cache.is_active or not self.user_cache.is_staff:
- raise forms.ValidationError(message)
+ raise forms.ValidationError(message % {
+ 'username': self.username_field.verbose_name
+ })
self.check_for_test_cookie()
return self.cleaned_data
4 django/contrib/admin/helpers.py
View
@@ -186,9 +186,7 @@ def contents(self):
if getattr(attr, "allow_tags", False):
result_repr = mark_safe(result_repr)
else:
- if value is None:
- result_repr = EMPTY_CHANGELIST_VALUE
- elif isinstance(f.rel, ManyToManyRel):
+ if isinstance(f.rel, ManyToManyRel) and value is not None:
result_repr = ", ".join(map(six.text_type, value.all()))
else:
result_repr = display_for_field(value, f)
13 django/contrib/admin/models.py
View
@@ -4,7 +4,7 @@
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.contrib.admin.util import quote
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import ugettext, ugettext_lazy as _
from django.utils.encoding import smart_text
from django.utils.encoding import python_2_unicode_compatible
@@ -42,13 +42,16 @@ def __repr__(self):
def __str__(self):
if self.action_flag == ADDITION:
- return _('Added "%(object)s".') % {'object': self.object_repr}
+ return ugettext('Added "%(object)s".') % {'object': self.object_repr}
elif self.action_flag == CHANGE:
- return _('Changed "%(object)s" - %(changes)s') % {'object': self.object_repr, 'changes': self.change_message}
+ return ugettext('Changed "%(object)s" - %(changes)s') % {
+ 'object': self.object_repr,
+ 'changes': self.change_message,
+ }
elif self.action_flag == DELETION:
- return _('Deleted "%(object)s."') % {'object': self.object_repr}
+ return ugettext('Deleted "%(object)s."') % {'object': self.object_repr}
- return _('LogEntry Object')
+ return ugettext('LogEntry Object')
def is_addition(self):
return self.action_flag == ADDITION
41 django/contrib/admin/options.py
View
@@ -1,3 +1,4 @@
+import copy
from functools import update_wrapper, partial
import warnings
@@ -130,7 +131,7 @@ def formfield_for_dbfield(self, db_field, **kwargs):
# passed to formfield_for_dbfield override the defaults.
for klass in db_field.__class__.mro():
if klass in self.formfield_overrides:
- kwargs = dict(self.formfield_overrides[klass], **kwargs)
+ kwargs = dict(copy.deepcopy(self.formfield_overrides[klass]), **kwargs)
return db_field.formfield(**kwargs)
# For any other type of field, just call its formfield() method.
@@ -407,8 +408,6 @@ def media(self):
js.append('actions%s.js' % extra)
if self.prepopulated_fields:
js.extend(['urlify.js', 'prepopulate%s.js' % extra])
- if self.opts.get_ordered_objects():
- js.extend(['getElementsBySelector.js', 'dom-drag.js' , 'admin/ordering.js'])
return forms.Media(js=[static('admin/js/%s' % url) for url in js])
def get_model_perms(self, request):
@@ -552,7 +551,7 @@ def log_deletion(self, request, object, object_repr):
"""
from django.contrib.admin.models import LogEntry, DELETION
LogEntry.objects.log_action(
- user_id = request.user.id,
+ user_id = request.user.pk,
content_type_id = ContentType.objects.get_for_model(self.model).pk,
object_id = object.pk,
object_repr = object_repr,
@@ -665,6 +664,13 @@ def get_list_display_links(self, request, list_display):
# Use only the first item in list_display as link
return list(list_display)[:1]
+ def get_list_filter(self, request):
+ """
+ Returns a sequence containing the fields to be displayed as filters in
+ the right sidebar of the changelist page.
+ """
+ return self.list_filter
+
def construct_change_message(self, request, form, formsets):
"""
Construct a change message from a changed object.
@@ -691,12 +697,30 @@ def construct_change_message(self, request, form, formsets):
change_message = ' '.join(change_message)
return change_message or _('No fields changed.')
- def message_user(self, request, message):
+ def message_user(self, request, message, level=messages.INFO, extra_tags='',
+ fail_silently=False):
"""
Send a message to the user. The default implementation
posts a message using the django.contrib.messages backend.
+
+ Exposes almost the same API as messages.add_message(), but accepts the
+ positional arguments in a different order to maintain backwards
+ compatibility. For convenience, it accepts the `level` argument as
+ a string rather than the usual level number.
"""
- messages.info(request, message)
+
+ if not isinstance(level, int):
+ # attempt to get the level if passed a string
+ try:
+ level = getattr(messages.constants, level.upper())
+ except AttributeError:
+ levels = messages.constants.DEFAULT_TAGS.values()
+ levels_repr = ', '.join('`%s`' % l for l in levels)
+ raise ValueError('Bad message level string: `%s`. '
+ 'Possible values are: %s' % (level, levels_repr))
+
+ messages.add_message(request, level, message, extra_tags=extra_tags,
+ fail_silently=fail_silently)
def save_form(self, request, form, change):
"""
@@ -738,7 +762,6 @@ def save_related(self, request, form, formsets, change):
def render_change_form(self, request, context, add=False, change=False, form_url='', obj=None):
opts = self.model._meta
app_label = opts.app_label
- ordered_objects = opts.get_ordered_objects()
context.update({
'add': add,
'change': change,
@@ -747,7 +770,6 @@ def render_change_form(self, request, context, add=False, change=False, form_url
'has_delete_permission': self.has_delete_permission(request, obj),
'has_file_field': True, # FIXME - this should check if form or formsets have a FileField,
'has_absolute_url': hasattr(self.model, 'get_absolute_url'),
- 'ordered_objects': ordered_objects,
'form_url': form_url,
'opts': opts,
'content_type_id': ContentType.objects.get_for_model(self.model).id,
@@ -1174,6 +1196,7 @@ def changelist_view(self, request, extra_context=None):
list_display = self.get_list_display(request)
list_display_links = self.get_list_display_links(request, list_display)
+ list_filter = self.get_list_filter(request)
# Check actions to see if any are available on this changelist
actions = self.get_actions(request)
@@ -1184,7 +1207,7 @@ def changelist_view(self, request, extra_context=None):
ChangeList = self.get_changelist(request)
try:
cl = ChangeList(request, self.model, list_display,
- list_display_links, self.list_filter, self.date_hierarchy,
+ list_display_links, list_filter, self.date_hierarchy,
self.search_fields, self.list_select_related,
self.list_per_page, self.list_max_show_all, self.list_editable,
self)
10 django/contrib/admin/sites.py
View
@@ -354,6 +354,7 @@ def index(self, request, extra_context=None):
info = (app_label, model._meta.module_name)
model_dict = {
'name': capfirst(model._meta.verbose_name_plural),
+ 'object_name': model._meta.object_name,
'perms': perms,
}
if perms.get('change', False):
@@ -371,6 +372,7 @@ def index(self, request, extra_context=None):
else:
app_dict[app_label] = {
'name': app_label.title(),
+ 'app_label': app_label,
'app_url': reverse('admin:app_list', kwargs={'app_label': app_label}, current_app=self.name),
'has_module_perms': has_module_perms,
'models': [model_dict],
@@ -389,9 +391,9 @@ def index(self, request, extra_context=None):
'app_list': app_list,
}
context.update(extra_context or {})
- return TemplateResponse(request, [
- self.index_template or 'admin/index.html',
- ], context, current_app=self.name)
+ return TemplateResponse(request, self.index_template or
+ 'admin/index.html', context,
+ current_app=self.name)
def app_index(self, request, app_label, extra_context=None):
user = request.user
@@ -408,6 +410,7 @@ def app_index(self, request, app_label, extra_context=None):
info = (app_label, model._meta.module_name)
model_dict = {
'name': capfirst(model._meta.verbose_name_plural),
+ 'object_name': model._meta.object_name,
'perms': perms,
}
if perms.get('change', False):
@@ -428,6 +431,7 @@ def app_index(self, request, app_label, extra_context=None):
# information.
app_dict = {
'name': app_label.title(),
+ 'app_label': app_label,
'app_url': '',
'has_module_perms': has_module_perms,
'models': [model_dict],
4 django/contrib/admin/static/admin/css/base.css
View
@@ -322,6 +322,10 @@ thead th.sorted {
background: #c5c5c5 url(../img/nav-bg-selected.gif) top left repeat-x;
}
+thead th.sorted .text {
+ padding-right: 42px;
+}
+
table thead th .text span {
padding: 2px 5px;
display:block;
5 django/contrib/admin/static/admin/css/rtl.css
View
@@ -84,6 +84,11 @@ table thead th.sorted .sortoptions {
float: left;
}
+thead th.sorted .text {
+ padding-right: 0;
+ padding-left: 42px;
+}
+
/* dashboard styles */
.dashboard .module table td a {
15 django/contrib/admin/static/admin/css/widgets.css
View
@@ -225,6 +225,21 @@ table p.datetime {
padding-left: 0;
}
+/* URL */
+
+p.url {
+ line-height: 20px;
+ margin: 0;
+ padding: 0;
+ color: #666;
+ font-size: 11px;
+ font-weight: bold;
+}
+
+.url a {
+ font-weight: normal;
+}
+
/* FILE UPLOADS */
p.file-upload {
137 django/contrib/admin/static/admin/js/admin/ordering.js
View
@@ -1,137 +0,0 @@
-addEvent(window, 'load', reorder_init);
-
-var lis;
-var top = 0;
-var left = 0;
-var height = 30;
-
-function reorder_init() {
- lis = document.getElementsBySelector('ul#orderthese li');
- var input = document.getElementsBySelector('input[name=order_]')[0];
- setOrder(input.value.split(','));
- input.disabled = true;
- draw();
- // Now initialize the dragging behavior
- var limit = (lis.length - 1) * height;
- for (var i = 0; i < lis.length; i++) {
- var li = lis[i];
- var img = document.getElementById('handle'+li.id);
- li.style.zIndex = 1;
- Drag.init(img, li, left + 10, left + 10, top + 10, top + 10 + limit);
- li.onDragStart = startDrag;
- li.onDragEnd = endDrag;
- img.style.cursor = 'move';
- }
-}
-
-function submitOrderForm() {
- var inputOrder = document.getElementsBySelector('input[name=order_]')[0];
- inputOrder.value = getOrder();
- inputOrder.disabled=false;
-}
-
-function startDrag() {
- this.style.zIndex = '10';
- this.className = 'dragging';
-}
-
-function endDrag(x, y) {
- this.style.zIndex = '1';
- this.className = '';
- // Work out how far along it has been dropped, using x co-ordinate
- var oldIndex = this.index;
- var newIndex = Math.round((y - 10 - top) / height);
- // 'Snap' to the correct position
- this.style.top = (10 + top + newIndex * height) + 'px';
- this.index = newIndex;
- moveItem(oldIndex, newIndex);
-}
-
-function moveItem(oldIndex, newIndex) {
- // Swaps two items, adjusts the index and left co-ord for all others
- if (oldIndex == newIndex) {
- return; // Nothing to swap;
- }
- var direction, lo, hi;
- if (newIndex > oldIndex) {
- lo = oldIndex;
- hi = newIndex;
- direction = -1;
- } else {
- direction = 1;
- hi = oldIndex;
- lo = newIndex;
- }
- var lis2 = new Array(); // We will build the new order in this array
- for (var i = 0; i < lis.length; i++) {
- if (i < lo || i > hi) {
- // Position of items not between the indexes is unaffected
- lis2[i] = lis[i];
- continue;
- } else if (i == newIndex) {
- lis2[i] = lis[oldIndex];
- continue;
- } else {
- // Item is between the two indexes - move it along 1
- lis2[i] = lis[i - direction];
- }
- }
- // Re-index everything
- reIndex(lis2);
- lis = lis2;
- draw();
-// document.getElementById('hiddenOrder').value = getOrder();
- document.getElementsBySelector('input[name=order_]')[0].value = getOrder();
-}
-
-function reIndex(lis) {
- for (var i = 0; i < lis.length; i++) {
- lis[i].index = i;
- }
-}
-
-function draw() {
- for (var i = 0; i < lis.length; i++) {
- var li = lis[i];
- li.index = i;
- li.style.position = 'absolute';
- li.style.left = (10 + left) + 'px';
- li.style.top = (10 + top + (i * height)) + 'px';
- }
-}
-
-function getOrder() {
- var order = new Array(lis.length);
- for (var i = 0; i < lis.length; i++) {
- order[i] = lis[i].id.substring(1, 100);
- }
- return order.join(',');
-}
-
-function setOrder(id_list) {
- /* Set the current order to match the lsit of IDs */
- var temp_lis = new Array();
- for (var i = 0; i < id_list.length; i++) {
- var id = 'p' + id_list[i];
- temp_lis[temp_lis.length] = document.getElementById(id);
- }
- reIndex(temp_lis);
- lis = temp_lis;
- draw();
-}
-
-function addEvent(elm, evType, fn, useCapture)
-// addEvent and removeEvent
-// cross-browser event handling for IE5+, NS6 and Mozilla
-// By Scott Andrew
-{
- if (elm.addEventListener){
- elm.addEventListener(evType, fn, useCapture);
- return true;
- } else if (elm.attachEvent){
- var r = elm.attachEvent("on"+evType, fn);
- return r;
- } else {
- elm['on'+evType] = fn;
- }
-}
167 django/contrib/admin/static/admin/js/getElementsBySelector.js
View
<
@@ -1,167 +0,0 @@
-/* document.getElementsBySelector(selector)
- - returns an array of element objects from the current document
- matching the CSS selector. Selectors can contain element names,
- class names and ids and can be nested. For example:
-
- elements = document.getElementsBySelect('div#main p a.external')
-
- Will return an array of all 'a' elements with 'external' in their
- class attribute that are contained inside 'p' elements that are
- contained inside the 'div' element which has id="main"
-
- New in version 0.4: Support for CSS2 and CSS3 attribute selectors:
- See http://www.w3.org/TR/css3-selectors/#attribute-selectors
-
- Version 0.4 - Simon Willison, March 25th 2003
- -- Works in Phoenix 0.5, Mozilla 1.3, Opera 7, Internet Explorer 6, Internet Explorer 5 on Windows
- -- Opera 7 fails
-*/
-
-function getAllChildren(e) {
- // Returns all children of element. Workaround required for IE5/Windows. Ugh.
- return e.all ? e.all : e.getElementsByTagName('*');
-}
-
-document.getElementsBySelector = function(selector) {
- // Attempt to fail gracefully in lesser browsers
- if (!document.getElementsByTagName) {
- return new Array();
- }
- // Split selector in to tokens
- var tokens = selector.split(' ');
- var currentContext = new Array(document);
- for (var i = 0; i < tokens.length; i++) {
- token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');;
- if (token.indexOf('#') > -1) {
- // Token is an ID selector
- var bits = token.split('#');
- var tagName = bits[0];
- var id = bits[1];
- var element = document.getElementById(id);
- if (!element || (tagName && element.nodeName.toLowerCase() != tagName)) {
- // ID not found or tag with that ID not found, return false.
- return new Array();
- }
- // Set currentContext to contain just this element
- currentContext = new Array(element);
- continue; // Skip to next token
- }
- if (token.indexOf('.') > -1) {
- // Token contains a class selector
- var bits = token.split('.');
- var tagName = bits[0];
- var className = bits[1];
- if (!tagName) {
- tagName = '*';
- }
- // Get elements matching tag, filter them for class selector
- var found = new Array;
- var foundCount = 0;
- for (var h = 0; h < currentContext.length; h++) {
- var elements;
- if (tagName == '*') {
- elements = getAllChildren(currentContext[h]);
- } else {
- try {
- elements = currentContext[h].getElementsByTagName(tagName);
- }
- catch(e) {
- elements = [];
- }
- }
- for (var j = 0; j < elements.length; j++) {
- found[foundCount++] = elements[j];
- }
- }
- currentContext = new Array;
- var currentContextIndex = 0;
- for (var k = 0; k < found.length; k++) {
- if (found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b'))) {
- currentContext[currentContextIndex++] = found[k];
- }
- }
- continue; // Skip to next token
- }
- // Code to deal with attribute selectors
- if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
- var tagName = RegExp.$1;
- var attrName = RegExp.$2;
- var attrOperator = RegExp.$3;
- var attrValue = RegExp.$4;
- if (!tagName) {
- tagName = '*';
- }
- // Grab all of the tagName elements within current context
- var found = new Array;
- var foundCount = 0;
- for (var h = 0; h < currentContext.length; h++) {
- var elements;
- if (tagName == '*') {
- elements = getAllChildren(currentContext[h]);
- } else {
- elements = currentContext[h].getElementsByTagName(tagName);
- }
- for (var j = 0; j < elements.length; j++) {
- found[foundCount++] = elements[j];
- }
- }
- currentContext = new Array;
- var currentContextIndex = 0;
- var checkFunction; // This function will be used to filter the elements
- switch (attrOperator) {
- case '=': // Equality
- checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };
- break;
- case '~': // Match one of space seperated words
- checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); };
- break;
- case '|': // Match start with value followed by optional hyphen
- checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); };
- break;
- case '^': // Match starts with value
- checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); };
- break;
- case '$': // Match ends with value - fails with "Warning" in Opera 7
- checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); };
- break;
- case '*': // Match ends with value
- checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); };
- break;
- default :
- // Just test for existence of attribute
- checkFunction = function(e) { return e.getAttribute(attrName); };
- }
- currentContext = new Array;
- var currentContextIndex = 0;
- for (var k = 0; k < found.length; k++) {
- if (checkFunction(found[k])) {
- currentContext[currentContextIndex++] = found[k];