mirror of
https://github.com/django/django.git
synced 2025-07-04 09:49:12 +00:00
i18n: merged r815:r843 from trunk
git-svn-id: http://code.djangoproject.com/svn/django/branches/i18n@844 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
d79cfec906
commit
d442731eb2
3
django/conf/admin_media/css/global.css
vendored
3
django/conf/admin_media/css/global.css
vendored
@ -230,6 +230,7 @@ fieldset.collapsed h2, fieldset.collapsed { display:block !important; }
|
||||
fieldset.collapsed .collapse-toggle { display: inline !important; }
|
||||
fieldset.collapse h2 a.collapse-toggle { color:#ffc; }
|
||||
fieldset.collapse h2 a.collapse-toggle:hover { text-decoration:underline; }
|
||||
.hidden { display:none; }
|
||||
|
||||
/* MESSAGES & ERRORS */
|
||||
|
||||
@ -348,7 +349,7 @@ p.file-upload { line-height:20px; margin:0; padding:0; color:#666; font-size:11p
|
||||
ul.timelist, .timelist li { list-style-type:none; margin:0; padding:0; }
|
||||
.timelist a { padding:2px; }
|
||||
|
||||
/* OLD ORDERING WIDGET */
|
||||
/* ORDERING WIDGET */
|
||||
|
||||
ul#orderthese { padding:0; margin:0; list-style-type:none; }
|
||||
ul#orderthese li { list-style-type:none; display:block; padding:0; margin:6px 0; width:214px; background:#f6f6f6; white-space:nowrap; overflow:hidden; }
|
||||
|
@ -72,7 +72,6 @@ class InvalidCacheBackendError(Exception):
|
||||
################################
|
||||
|
||||
class _Cache:
|
||||
|
||||
def __init__(self, params):
|
||||
timeout = params.get('timeout', 300)
|
||||
try:
|
||||
@ -132,8 +131,7 @@ except ImportError:
|
||||
_MemcachedCache = None
|
||||
else:
|
||||
class _MemcachedCache(_Cache):
|
||||
"""Memcached cache backend."""
|
||||
|
||||
"Memcached cache backend."
|
||||
def __init__(self, server, params):
|
||||
_Cache.__init__(self, params)
|
||||
self._cache = memcache.Client([server])
|
||||
@ -161,8 +159,7 @@ else:
|
||||
import time
|
||||
|
||||
class _SimpleCache(_Cache):
|
||||
"""Simple single-process in-memory cache"""
|
||||
|
||||
"Simple single-process in-memory cache."
|
||||
def __init__(self, host, params):
|
||||
_Cache.__init__(self, params)
|
||||
self._cache = {}
|
||||
@ -230,11 +227,11 @@ try:
|
||||
import cPickle as pickle
|
||||
except ImportError:
|
||||
import pickle
|
||||
import copy
|
||||
from django.utils.synch import RWLock
|
||||
|
||||
class _LocMemCache(_SimpleCache):
|
||||
"""Thread-safe in-memory cache"""
|
||||
|
||||
"Thread-safe in-memory cache."
|
||||
def __init__(self, host, params):
|
||||
_SimpleCache.__init__(self, host, params)
|
||||
self._lock = RWLock()
|
||||
@ -250,7 +247,7 @@ class _LocMemCache(_SimpleCache):
|
||||
elif exp < now:
|
||||
should_delete = True
|
||||
else:
|
||||
return self._cache[key]
|
||||
return copy.deepcopy(self._cache[key])
|
||||
finally:
|
||||
self._lock.reader_leaves()
|
||||
if should_delete:
|
||||
@ -284,8 +281,7 @@ import os
|
||||
import urllib
|
||||
|
||||
class _FileCache(_SimpleCache):
|
||||
"""File-based cache"""
|
||||
|
||||
"File-based cache."
|
||||
def __init__(self, dir, params):
|
||||
self._dir = dir
|
||||
if not os.path.exists(self._dir):
|
||||
@ -366,8 +362,7 @@ from django.core.db import db, DatabaseError
|
||||
from datetime import datetime
|
||||
|
||||
class _DBCache(_Cache):
|
||||
"""SQL cache backend"""
|
||||
|
||||
"SQL cache backend."
|
||||
def __init__(self, table, params):
|
||||
_Cache.__init__(self, params)
|
||||
self._table = table
|
||||
|
@ -144,6 +144,10 @@ def get_sql_delete(mod):
|
||||
for row in cursor.fetchall():
|
||||
output.append("DELETE FROM auth_admin_log WHERE content_type_id = %s;" % row[0])
|
||||
|
||||
# Close database connection explicitly, in case this output is being piped
|
||||
# directly into a database client, to avoid locking issues.
|
||||
db.db.close()
|
||||
|
||||
return output[::-1] # Reverse it, to deal with table dependencies.
|
||||
get_sql_delete.help_doc = "Prints the DROP TABLE SQL statements for the given model module name(s)."
|
||||
get_sql_delete.args = APP_ARGS
|
||||
|
@ -1,4 +1,3 @@
|
||||
import copy
|
||||
from django.conf import settings
|
||||
from django.core.cache import cache
|
||||
from django.utils.cache import get_cache_key, learn_cache_key, patch_response_headers
|
||||
@ -49,7 +48,7 @@ class CacheMiddleware:
|
||||
return None # No cache information available, need to rebuild.
|
||||
|
||||
request._cache_update_cache = False
|
||||
return copy.copy(response)
|
||||
return response
|
||||
|
||||
def process_response(self, request, response):
|
||||
"Sets the cache, if needed."
|
||||
|
@ -12,6 +12,10 @@ def decorator_from_middleware(middleware_class):
|
||||
result = middleware.process_request(request)
|
||||
if result is not None:
|
||||
return result
|
||||
if hasattr(middleware, 'process_view'):
|
||||
result = middleware.process_view(request, view_func, **kwargs)
|
||||
if result is not None:
|
||||
return result
|
||||
response = view_func(request, *args, **kwargs)
|
||||
if hasattr(middleware, 'process_response'):
|
||||
result = middleware.process_response(request, response)
|
||||
|
@ -32,6 +32,8 @@ def object_list(request, app_label, module_name, paginate_by=None, allow_empty=F
|
||||
the previous page
|
||||
pages
|
||||
number of pages, total
|
||||
hits
|
||||
number of objects, total
|
||||
"""
|
||||
mod = models.get_module(app_label, module_name)
|
||||
lookup_kwargs = extra_lookup_kwargs.copy()
|
||||
@ -56,6 +58,7 @@ def object_list(request, app_label, module_name, paginate_by=None, allow_empty=F
|
||||
'next': page + 1,
|
||||
'previous': page - 1,
|
||||
'pages': paginator.pages,
|
||||
'hits' : paginator.hits,
|
||||
})
|
||||
else:
|
||||
object_list = mod.get_list(**lookup_kwargs)
|
||||
|
@ -449,8 +449,7 @@ Related objects (e.g. ``Choices``) are created using convenience functions::
|
||||
>>> p.get_choice_count()
|
||||
4
|
||||
|
||||
Each of those ``add_choice`` methods is equivalent to (except obviously much
|
||||
simpler than)::
|
||||
Each of those ``add_choice`` methods is equivalent to (but much simpler than)::
|
||||
|
||||
>>> c = polls.Choice(poll_id=p.id, choice="Over easy", votes=0)
|
||||
>>> c.save()
|
||||
@ -459,6 +458,8 @@ Note that when using the `add_foo()`` methods, you do not give any value
|
||||
for the ``id`` field, nor do you give a value for the field that stores
|
||||
the relation (``poll_id`` in this case).
|
||||
|
||||
The ``add_FOO()`` method always returns the newly created object.
|
||||
|
||||
Deleting objects
|
||||
================
|
||||
|
||||
|
@ -115,7 +115,7 @@ The date-based generic functions are:
|
||||
Yearly archive. Requires that the ``year`` argument be present in the URL
|
||||
pattern.
|
||||
|
||||
Uses the template ``app_label/module_name__archive_year`` by default.
|
||||
Uses the template ``app_label/module_name_archive_year`` by default.
|
||||
|
||||
Has the following template context:
|
||||
|
||||
@ -134,7 +134,7 @@ The date-based generic functions are:
|
||||
default, which is a three-letter month abbreviation. To change it to use
|
||||
numbers, use ``"%m"``.
|
||||
|
||||
Uses the template ``app_label/module_name__archive_month`` by default.
|
||||
Uses the template ``app_label/module_name_archive_month`` by default.
|
||||
|
||||
Has the following template context:
|
||||
|
||||
@ -151,7 +151,7 @@ The date-based generic functions are:
|
||||
also pass ``day_format``, which defaults to ``"%d"`` (day of the month as a
|
||||
decimal number, 1-31).
|
||||
|
||||
Uses the template ``app_label/module_name__archive_day`` by default.
|
||||
Uses the template ``app_label/module_name_archive_day`` by default.
|
||||
|
||||
Has the following template context:
|
||||
|
||||
@ -246,6 +246,8 @@ Individual views are:
|
||||
The previous page
|
||||
``pages``
|
||||
Number of pages total
|
||||
``hits``
|
||||
Total number of objects
|
||||
|
||||
``object_detail``
|
||||
Object detail page. This works like and takes the same arguments as
|
||||
@ -272,7 +274,7 @@ The create/update/delete views are:
|
||||
be interpolated against the object's field attributes. For example, you
|
||||
could use ``post_save_redirect="/polls/%(slug)s/"``.
|
||||
|
||||
Uses the template ``app_label/module_name__form`` by default. This is the
|
||||
Uses the template ``app_label/module_name_form`` by default. This is the
|
||||
same template as the ``update_object`` view below. Your template can tell
|
||||
the different by the presence or absence of ``{{ object }}`` in the
|
||||
context.
|
||||
@ -294,7 +296,7 @@ The create/update/delete views are:
|
||||
``list_detail.object_detail`` does (see above), and the same
|
||||
``post_save_redirect`` as ``create_object`` does.
|
||||
|
||||
Uses the template ``app_label/module_name__form`` by default.
|
||||
Uses the template ``app_label/module_name_form`` by default.
|
||||
|
||||
Has the following template context:
|
||||
|
||||
|
@ -721,7 +721,9 @@ Here's a list of all possible ``META`` options. No options are required. Adding
|
||||
unique_together = (("driver", "restaurant"),)
|
||||
|
||||
This is a list of lists of fields that must be unique when considered
|
||||
together. It's used in the Django admin.
|
||||
together. It's used in the Django admin and is enforced at the database
|
||||
level (i.e., the appropriate ``UNIQUE`` statements are included in the
|
||||
``CREATE TABLE`` statement).
|
||||
|
||||
``verbose_name``
|
||||
A human-readable name for the object, singular::
|
||||
|
Loading…
x
Reference in New Issue
Block a user