1
0
mirror of https://github.com/django/django.git synced 2025-07-05 18:29:11 +00:00

Merged to trunk r1253

git-svn-id: http://code.djangoproject.com/svn/django/branches/new-admin@1255 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Robert Wittams 2005-11-16 00:12:31 +00:00
commit 2bbfb4b815
32 changed files with 1223 additions and 9 deletions

View File

@ -37,6 +37,7 @@ LANGUAGES = (
('bn', _('Bengali')),
('cs', _('Czech')),
('cy', _('Welsh')),
('da', _('Danish')),
('de', _('German')),
('en', _('English')),
('es', _('Spanish')),

View File

@ -1072,6 +1072,11 @@ msgstr "চেক"
msgid "Welsh"
msgstr "ওয়েল্শ"
#: conf/global_settings.py:40
#, fuzzy
msgid "Danish"
msgstr "স্প্যানিশ"
#: conf/global_settings.py:40
msgid "German"
msgstr "জার্মান"

View File

@ -1079,6 +1079,11 @@ msgstr "Česky"
msgid "Welsh"
msgstr "Welšsky"
#: conf/global_settings.py:40
#, fuzzy
msgid "Danish"
msgstr "Španělsky"
#: conf/global_settings.py:40
msgid "German"
msgstr "Německy"

View File

@ -1075,6 +1075,11 @@ msgstr "Tsieceg"
msgid "Welsh"
msgstr "Cymraeg"
#: conf/global_settings.py:40
#, fuzzy
msgid "Danish"
msgstr "Spaeneg"
#: conf/global_settings.py:40
msgid "German"
msgstr "Almaeneg"

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1328,6 +1328,10 @@ msgstr "Tschechisch"
msgid "Welsh"
msgstr "Walisisch"
#: conf/global_settings.py:40
msgid "Danish"
msgstr "Dänisch"
#: conf/global_settings.py:40
msgid "German"
msgstr "Deutsch"

View File

@ -1041,6 +1041,10 @@ msgstr ""
msgid "Welsh"
msgstr ""
#: conf/global_settings.py:40
msgid "Danish"
msgstr ""
#: conf/global_settings.py:40
msgid "German"
msgstr ""

View File

@ -1069,6 +1069,10 @@ msgstr ""
msgid "Welsh"
msgstr ""
#: conf/global_settings.py:40
msgid "Danish"
msgstr ""
#: conf/global_settings.py:40
msgid "German"
msgstr ""

View File

@ -1083,6 +1083,11 @@ msgstr "Tch
msgid "Welsh"
msgstr ""
#: conf/global_settings.py:40
#, fuzzy
msgid "Danish"
msgstr "Espagnol"
#: conf/global_settings.py:40
msgid "German"
msgstr "Allemand"

View File

@ -1068,6 +1068,10 @@ msgstr ""
msgid "Welsh"
msgstr ""
#: conf/global_settings.py:40
msgid "Danish"
msgstr ""
#: conf/global_settings.py:40
msgid "German"
msgstr ""

View File

@ -1077,6 +1077,11 @@ msgstr "Tékkneska"
msgid "Welsh"
msgstr "Velska"
#: conf/global_settings.py:40
#, fuzzy
msgid "Danish"
msgstr "Spænska"
#: conf/global_settings.py:40
msgid "German"
msgstr "Þýska"

View File

@ -1076,6 +1076,11 @@ msgstr ""
msgid "Welsh"
msgstr ""
#: conf/global_settings.py:40
#, fuzzy
msgid "Danish"
msgstr "Spagnolo"
#: conf/global_settings.py:40
msgid "German"
msgstr "Tedesco"

View File

@ -1077,6 +1077,11 @@ msgstr "Tsjekkisk"
msgid "Welsh"
msgstr ""
#: conf/global_settings.py:40
#, fuzzy
msgid "Danish"
msgstr "Spansk"
#: conf/global_settings.py:40
msgid "German"
msgstr "Tysk"

View File

@ -1080,6 +1080,11 @@ msgstr "Tcheco"
msgid "Welsh"
msgstr ""
#: conf/global_settings.py:40
#, fuzzy
msgid "Danish"
msgstr "Espanhol"
#: conf/global_settings.py:40
msgid "German"
msgstr "Alemão"

View File

@ -1077,6 +1077,11 @@ msgstr "Cehă"
msgid "Welsh"
msgstr ""
#: conf/global_settings.py:40
#, fuzzy
msgid "Danish"
msgstr "Spaniolă"
#: conf/global_settings.py:40
msgid "German"
msgstr "Germană"

View File

@ -1066,6 +1066,10 @@ msgstr ""
msgid "Welsh"
msgstr ""
#: conf/global_settings.py:40
msgid "Danish"
msgstr ""
#: conf/global_settings.py:40
msgid "German"
msgstr ""

View File

@ -1072,7 +1072,7 @@ msgstr "Zpráva"
#: conf/global_settings.py:37
msgid "Bengali"
msgstr ""
msgstr "Bengálsky"
#: conf/global_settings.py:38
msgid "Czech"
@ -1080,7 +1080,7 @@ msgstr "Český"
#: conf/global_settings.py:39
msgid "Welsh"
msgstr ""
msgstr "Waleský"
#: conf/global_settings.py:40
msgid "German"
@ -1104,7 +1104,7 @@ msgstr "Galicijský"
#: conf/global_settings.py:45
msgid "Icelandic"
msgstr ""
msgstr "Islandský"
#: conf/global_settings.py:46
msgid "Italian"
@ -1120,7 +1120,7 @@ msgstr "Brazílsky"
#: conf/global_settings.py:49
msgid "Romanian"
msgstr ""
msgstr "Rumúnsky"
#: conf/global_settings.py:50
msgid "Russian"

View File

@ -1080,6 +1080,11 @@ msgstr "Češki"
msgid "Welsh"
msgstr "Welšski"
#: conf/global_settings.py:40
#, fuzzy
msgid "Danish"
msgstr "Španski"
#: conf/global_settings.py:40
msgid "German"
msgstr "Nemački"

View File

@ -1078,6 +1078,11 @@ msgstr "Tjeckiska"
msgid "Welsh"
msgstr "Walesiska"
#: conf/global_settings.py:40
#, fuzzy
msgid "Danish"
msgstr "Spanska"
#: conf/global_settings.py:40
msgid "German"
msgstr "Tyska"

View File

@ -1066,6 +1066,11 @@ msgstr "捷克语"
msgid "Welsh"
msgstr "威尔士语"
#: conf/global_settings.py:40
#, fuzzy
msgid "Danish"
msgstr "西斑牙语"
#: conf/global_settings.py:40
msgid "German"
msgstr "德语"

View File

@ -24,7 +24,7 @@ class DatabaseWrapper:
if DATABASE_USER:
conn_string = "user=%s %s" % (DATABASE_USER, conn_string)
if DATABASE_PASSWORD:
conn_string += " password=%s" % DATABASE_PASSWORD
conn_string += " password='%s'" % DATABASE_PASSWORD
if DATABASE_HOST:
conn_string += " host=%s" % DATABASE_HOST
if DATABASE_PORT:

View File

@ -102,6 +102,7 @@ class FormWrapper:
self.manipulator, self.data = manipulator, data
self.error_dict = error_dict
self._inline_collections = None
self.fields = [self.__getitem__(field.field_name) for field in self.manipulator.fields]
self.edit_inline = edit_inline
def __repr__(self):

View File

@ -34,6 +34,9 @@ class AnonymousUser:
def has_perm(self, perm):
return False
def has_module_perms(self, module):
return False
def get_and_delete_messages(self):
return []

View File

@ -163,6 +163,23 @@ def do_translate(parser, token):
def do_block_translate(parser, token):
"""
This will translate a block of text with parameters.
Format is like this::
{% blocktrans with foo|filter as bar and baz|filter as boo %}
This is {{ bar }} and {{ boo }}.
{% endblocktrans %}
Additionally this supports pluralization::
{% blocktrans count var|length as count %}
There is {{ count }} object.
{% plural %}
There are {{ count }} objects.
{% endblocktrans %}
This is much like ngettext, only in template syntax.
"""
class BlockTranslateParser(TokenParser):

View File

@ -1,3 +1,4 @@
import re
import os
import sys
import inspect
@ -6,6 +7,8 @@ from os.path import dirname, join as pathjoin
from django.core.template import Template, Context
from django.utils.httpwrappers import HttpResponseServerError, HttpResponseNotFound
HIDDEN_SETTINGS = re.compile('SECRET|PASSWORD')
def technical_500_response(request, exc_type, exc_value, tb):
"""
Create a technical server error response. The last three arguments are
@ -30,7 +33,17 @@ def technical_500_response(request, exc_type, exc_value, tb):
'pre_context_lineno' : pre_context_lineno,
})
tb = tb.tb_next
# Turn the settings module into a dict, filtering out anything that
# matches HIDDEN_SETTINGS along the way.
settings_dict = {}
for k in dir(settings):
if k.isupper():
if HIDDEN_SETTINGS.search(k):
settings_dict[k] = '********************'
else:
settings_dict[k] = getattr(settings, k)
t = Template(TECHNICAL_500_TEMPLATE)
c = Context({
'exception_type' : exc_type.__name__,
@ -39,7 +52,7 @@ def technical_500_response(request, exc_type, exc_value, tb):
'lastframe' : frames[-1],
'request' : request,
'request_protocol' : os.environ.get("HTTPS") == "on" and "https" or "http",
'settings' : dict([(k, getattr(settings, k)) for k in dir(settings) if k.isupper()]),
'settings' : settings_dict,
})
return HttpResponseServerError(t.render(c))

View File

@ -0,0 +1,28 @@
from django.core.extensions import DjangoContext, render_to_response
from django.utils.httpwrappers import HttpResponse, HttpResponseRedirect, HttpResponseGone
def direct_to_template(request, template, **kwargs):
"""
Render a given template with any extra URL parameters in the context as
``{{ params }}``.
"""
return render_to_response(template, {'params' : kwargs}, context_instance=DjangoContext(request))
def redirect_to(request, url, **kwargs):
"""
Redirect to a given URL.
The given url may contain dict-style string formatting which will be
interpolated against the params in the URL. For example, to redirect from
``/foo/<id>/`` to ``/bar/<id>/``, you could use the following urlpattern::
urlpatterns = patterns('',
('^foo/(?p<id>\d+)/$', 'django.views.generic.simple.redirect_to', {'url' : '/bar/%(id)s/'}),
)
If the given url is ``None``, a HttpResponseGone (410) will be issued.
"""
if url is not None:
return HttpResponseRedirect(url % kwargs)
else:
return HttpResponseGone()

View File

@ -143,6 +143,16 @@ problems in similar ways, but it was too late to integrate outside code: We'd
already written, tested and implemented our own framework bits in several
production settings -- and our own code met our needs delightfully.
In most cases, however, we found that existing frameworks/tools inevitably had
some sort of fundamental, fatal flaw that made us squeamish. No tool fit our
philosophies 100%.
Like we said: We're picky.
We've documented our philosophies on the `design philosophies page`_.
.. _design philosophies page: http://www.djangoproject.com/documentation/design_philosophies/
Do you have any of those nifty "screencast" things?
---------------------------------------------------

View File

@ -57,8 +57,8 @@ arguments may either come from the URL pattern (as ``month``, ``day``,
``year``, etc. do above) or from the additional-information dictionary (as for
``app_label``, ``module_name``, etc.).
All the generic views that follow require the ``app_label`` and ``module_name`` keys.
These values are easiest to explain through example::
Most of the generic views that follow require the ``app_label`` and
``module_name`` keys. These values are easiest to explain through example::
>>> from django.models.blog import entries
@ -68,6 +68,42 @@ holds all your model definitions) and ``entries`` is the ``module_name``
of the ``module_name`` option of your model). In the docs below, these keys
will not be repeated, but each generic view requires them.
Using "simple" generic views
============================
The ``django.views.generic.simple`` module contains simple views to handle a
couple of common cases: rendering a template when no view logic is needed,
and issuing a redirect. These views are:
``direct_to_template``
Renders a given template using any extra parameters passed in the
urlpattern; requires the ``template`` argument.
For example, given the following URL patterns::
urlpatterns = patterns('django.views.generic.simple',
(r'^foo/$', 'direct_to_template', {'template' : 'foo_index'}),
(r'^foo/(?P<id>\d+)/$', 'direct_to_template', {'template' : 'foo_detail'}),
)
... a request to ``/foo/`` would cause the ``foo_index`` template to be
rendered, and a request to ``/foo/15/`` would cause the ``foo_detail``
template to be rendered with a context variable ``{{ params.id }}`` that is
set to ``15``.
``redirect_to``
Issue a redirect to a given URL.
The given url may contain dict-style string formatting which will be
interpolated against the params in the URL. For example, to redirect from
``/foo/<id>/`` to ``/bar/<id>/``, you could use the following urlpattern::
urlpatterns = patterns('django.views.generic.simple',
('^foo/(?p<id>\d+)/$', 'redirect_to', {'url' : '/bar/%(id)s/'}),
)
If the given url is ``None``, a HttpResponseGone (410) will be issued.
Using date-based generic views
==============================
@ -322,3 +358,4 @@ The create/update/delete views are:
object
The object about to be deleted

View File

@ -409,6 +409,7 @@ Default: A tuple of all available languages. Currently, this is::
('bn', _('Bengali')),
('cs', _('Czech')),
('cy', _('Welsh')),
('da', _('Danish')),
('de', _('German')),
('en', _('English')),
('es', _('Spanish')),