1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

newforms-admin: Merged to [4640]

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@4641 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty
2007-02-28 05:09:20 +00:00
parent 5e34ce97df
commit ff3423ca4c
18 changed files with 145 additions and 86 deletions

View File

@@ -99,7 +99,7 @@ SERVER_EMAIL = 'root@localhost'
SEND_BROKEN_LINK_EMAILS = False
# Database connection info.
DATABASE_ENGINE = '' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_NAME = '' # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.

View File

@@ -1,22 +1,22 @@
# translation of django.po to Castellano
# This file is distributed under the same license as the PACKAGE package.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER.
# Copyright (C) 2007 THE PACKAGE'S COPYRIGHT HOLDER.
#
# Ricardo Javier C<>rdenes Medina <ricardo.cardenes@gmail.com>, 2005.
# Ricardo Javier Cardenes Medina <ricardo.cardenes@gmail.com>, 2005.
# AgarFu <heaven@croasanaso.sytes.net>, 2007.
# Mario Gonzalez <gonzalemario @t gmail.com>
msgid ""
msgstr ""
"Project-Id-Version: django\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-02-24 17:08+0000\n"
"PO-Revision-Date: 2007-02-24 17:12+0000\n"
"PO-Revision-Date: 2007-02-24 18:02-0600\n"
"Last-Translator: AgarFu <heaven@croasanaso.sytes.net>\n"
"Language-Team: Castellano <es@li.org>\n"
"Language-Team: Castellano <Django-I18N@googlegroups.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.11.4\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: utils/dates.py:6
@@ -187,7 +187,7 @@ msgstr[1] "meses"
msgid "week"
msgid_plural "weeks"
msgstr[0] "semana"
msgstr[1] ""
msgstr[1] "semanas"
#: utils/timesince.py:15
msgid "day"
@@ -209,23 +209,23 @@ msgstr[1] "minutos"
#: utils/translation/trans_real.py:362
msgid "DATE_FORMAT"
msgstr "FORMATO_DE_FECHA"
msgstr "j N Y"
#: utils/translation/trans_real.py:363
msgid "DATETIME_FORMAT"
msgstr "FORMATO_DE_FECHA_Y_HORA"
msgstr "j N Y P"
#: utils/translation/trans_real.py:364
msgid "TIME_FORMAT"
msgstr "FORMATO_DE_HORA"
msgstr "P"
#: utils/translation/trans_real.py:380
msgid "YEAR_MONTH_FORMAT"
msgstr "FORMATO_DE_A<EFBFBD>O_Y_MES"
msgstr "F Y"
#: utils/translation/trans_real.py:381
msgid "MONTH_DAY_FORMAT"
msgstr "FORMATO_DE_MES_Y_D<EFBFBD>A"
msgstr "j \\de F"
#: conf/global_settings.py:39
msgid "Arabic"
@@ -340,9 +340,8 @@ msgid "Slovak"
msgstr "Eslovaco"
#: conf/global_settings.py:67
#, fuzzy
msgid "Slovenian"
msgstr "Eslovaco"
msgstr "Esloveno"
#: conf/global_settings.py:68
msgid "Serbian"
@@ -354,7 +353,7 @@ msgstr "Sueco"
#: conf/global_settings.py:70
msgid "Tamil"
msgstr ""
msgstr "Tamil"
#: conf/global_settings.py:71
msgid "Turkish"
@@ -388,14 +387,12 @@ msgid "Please enter a valid %s."
msgstr "Por favor, introduzca un %s v<>lido."
#: db/models/fields/related.py:642
#, fuzzy
msgid "Separate multiple IDs with commas."
msgstr " Separe m<>ltiples IDs con comas."
msgstr "Separe m<>ltiples IDs con comas."
#: db/models/fields/related.py:644
#, fuzzy
msgid "Hold down \"Control\", or \"Command\" on a Mac, to select more than one."
msgstr "Pulse \"Control\" o \"Command\" en un Mac para escoger m<>s de uno."
msgstr "Mantenga presionado \"Control\", o \"Command\" en un Mac, para seleccionar m<>s de uno."
#: db/models/fields/related.py:691
#, python-format
@@ -462,9 +459,9 @@ msgid "Select a valid choice. %s is not one of the available choices."
msgstr "Escoja una opci<63>n v<>lida; '%s' no es una de las opciones disponibles."
#: newforms/fields.py:101 newforms/fields.py:254
#, fuzzy, python-format
#, python-format
msgid "Ensure this value has at most %d characters."
msgstr "Aseg<65>rese de que su texto tiene menos de %s car<EFBFBD>cter."
msgstr "Aseg<65>rese de que su texto tiene a lo m<>s %d caracteres."
#: newforms/fields.py:103 newforms/fields.py:256
#, python-format
@@ -478,7 +475,7 @@ msgstr "Introduzca un n
#: newforms/fields.py:128
#, python-format
msgid "Ensure this value is less than or equal to %s."
msgstr "Aseg<65>urese de que este valor es menor o igual a %s."
msgstr "Aseg<65>rese de que este valor es menor o igual a %s."
#: newforms/fields.py:130
#, python-format
@@ -533,11 +530,10 @@ msgid "This value must contain only letters, numbers and underscores."
msgstr "Este valor debe contener s<>lo letras, n<>meros y guiones bajos."
#: core/validators.py:68
#, fuzzy
msgid ""
"This value must contain only letters, numbers, underscores, dashes or "
"slashes."
msgstr "Este valor debe contener s<EFBFBD>lo letras, n<>meros, guiones bajos y barras (/)."
msgstr "Este valor debe contener letras, n<>meros, guiones bajos o barras solamente."
#: core/validators.py:72
msgid "This value must contain only letters, numbers, underscores or hyphens."
@@ -659,8 +655,8 @@ msgstr "Introduzca una abreviatura v
#, python-format
msgid "Watch your mouth! The word %s is not allowed here."
msgid_plural "Watch your mouth! The words %s are not allowed here."
msgstr[0] "<22>Vigila tu boca! Aqu<71> no admitimos la palabra %s."
msgstr[1] "<22>Vigila tu boca! Aqu<71> no admitimos las palabras %s."
msgstr[0] "<22>Cuida tu vocabulario! Aqu<71> no admitimos la palabra %s."
msgstr[1] "<22>Cuida tu vocabulario! Aqu<71> no admitimos las palabras %s."
#: core/validators.py:272
#, python-format
@@ -690,9 +686,9 @@ msgid "Duplicate values are not allowed."
msgstr "No se admiten valores duplicados."
#: core/validators.py:364
#, fuzzy, python-format
#, python-format
msgid "This value must be between %(lower)s and %(upper)s."
msgstr "Este valor no debe ser mayor que %s."
msgstr "Este valor debe estar entre %(lower)s y %(upper)s."
#: core/validators.py:367
#, python-format
@@ -725,7 +721,7 @@ msgstr[1] ""
"total."
#: core/validators.py:423
#, fuzzy, python-format
#, python-format
msgid "Please enter a valid decimal number with a whole part of at most %s digit."
msgid_plural "Please enter a valid decimal number with a whole part of at most %s digits."
msgstr[0] ""
@@ -901,13 +897,12 @@ msgid "template name"
msgstr "nombre de plantilla"
#: contrib/flatpages/models.py:13
#, fuzzy
msgid ""
"Example: 'flatpages/contact_page.html'. If this isn't provided, the system "
"will use 'flatpages/default.html'."
msgstr ""
"Ejemplo: 'flatpages/contact_page'. Si no lo proporciona, el sistema usar<61> "
"'flatpages/default'."
"Ejemplo: 'flatpages/contact_page.html'. Si no es proporcionado, el sistema usar<61> "
"'flatpages/default.html'."
#: contrib/flatpages/models.py:14
msgid "registration required"
@@ -926,9 +921,8 @@ msgid "flat pages"
msgstr "p<>ginas est<73>ticas"
#: contrib/auth/views.py:39
#, fuzzy
msgid "Logged out"
msgstr "Terminar sesi<73>n"
msgstr "Sesi<EFBFBD>n terminada"
#: contrib/auth/models.py:38 contrib/auth/models.py:57
msgid "name"
@@ -1225,12 +1219,10 @@ msgid "approved by staff"
msgstr "aprobado por el staff"
#: contrib/comments/models.py:176
#, fuzzy
msgid "free comment"
msgstr "Comentario libre"
#: contrib/comments/models.py:177
#, fuzzy
msgid "free comments"
msgstr "Comentarios libres"
@@ -1243,12 +1235,10 @@ msgid "score date"
msgstr "fecha de la puntuaci<63>n"
#: contrib/comments/models.py:237
#, fuzzy
msgid "karma score"
msgstr "Punto karma"
#: contrib/comments/models.py:238
#, fuzzy
msgid "karma scores"
msgstr "Puntos karma"
@@ -1273,12 +1263,10 @@ msgid "flag date"
msgstr "fecha de la marca"
#: contrib/comments/models.py:268
#, fuzzy
msgid "user flag"
msgstr "Marca de usuario"
#: contrib/comments/models.py:269
#, fuzzy
msgid "user flags"
msgstr "Marcas de usuario"
@@ -1292,12 +1280,10 @@ msgid "deletion date"
msgstr "fecha de eliminaci<63>n"
#: contrib/comments/models.py:280
#, fuzzy
msgid "moderator deletion"
msgstr "Eliminaci<63>n de moderador"
#: contrib/comments/models.py:281
#, fuzzy
msgid "moderator deletions"
msgstr "Eliminaciones de moderador"
@@ -1758,7 +1744,7 @@ msgstr "Acci
#: contrib/admin/templates/admin/object_history.html:26
msgid "DATE_WITH_TIME_FULL"
msgstr "FECHA_CON_TIEMP_COMPLETO"
msgstr "j M Y P"
#: contrib/admin/templates/admin/object_history.html:36
msgid ""
@@ -2330,9 +2316,8 @@ msgid "Add user"
msgstr "A<>adir usuario"
#: contrib/admin/views/auth.py:57
#, fuzzy
msgid "Password changed successfully."
msgstr "Cambio de clave exitoso"
msgstr "La clave se ha cambiado exitosamente."
#: contrib/admin/views/auth.py:64
#, python-format

View File

@@ -21,7 +21,7 @@ msgstr ""
#: contrib/admin/media/js/SelectFilter2.js:33
#, perl-format
msgid "Available %s"
msgstr ""
msgstr "Tillgänglig %s"
#: contrib/admin/media/js/SelectFilter2.js:41
#, fuzzy
@@ -30,39 +30,39 @@ msgstr "Välj en tidpunkt"
#: contrib/admin/media/js/SelectFilter2.js:46
msgid "Add"
msgstr ""
msgstr "Lägg till"
#: contrib/admin/media/js/SelectFilter2.js:48
msgid "Remove"
msgstr ""
msgstr "Tag bort"
#: contrib/admin/media/js/SelectFilter2.js:53
#, perl-format
msgid "Chosen %s"
msgstr ""
msgstr "Valde %s"
#: contrib/admin/media/js/SelectFilter2.js:54
msgid "Select your choice(s) and click "
msgstr ""
msgstr "Välj ditt/dina val och klicka "
#: contrib/admin/media/js/SelectFilter2.js:59
msgid "Clear all"
msgstr ""
msgstr "Avmarkera alla"
#: contrib/admin/media/js/dateparse.js:26
#: contrib/admin/media/js/calendar.js:24
msgid ""
"January February March April May June July August September October November "
"December"
msgstr ""
msgstr "Januari Februari Mars April Maj Juni Juli Augusti September Oktober November December"
#: contrib/admin/media/js/dateparse.js:27
msgid "Sunday Monday Tuesday Wednesday Thursday Friday Saturday"
msgstr ""
msgstr "Söndag Mondag Tisdag Onsdag Torsdag Fredag Lördag"
#: contrib/admin/media/js/calendar.js:25
msgid "S M T W T F S"
msgstr ""
msgstr "S M T O T F L"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:45
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:80
@@ -92,7 +92,7 @@ msgstr "Mitt på dagen"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:87
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:168
msgid "Cancel"
msgstr "Ångra"
msgstr "Avbryt"
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:111
#: contrib/admin/media/js/admin/DateTimeShortcuts.js:162

View File

@@ -9,7 +9,7 @@ ADMINS = (
MANAGERS = ADMINS
DATABASE_ENGINE = '' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_NAME = '' # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.

View File

@@ -1,6 +0,0 @@
from django.conf.urls.defaults import *
urlpatterns = patterns('django.views',
(r'^$', 'registration.passwords.password_reset', {'is_admin_site' : True}),
(r'^done/$', 'registration.passwords.password_reset_done'),
)

View File

@@ -1,19 +0,0 @@
from django.conf.urls.defaults import *
urlpatterns = patterns('',
(r'^login/$', 'django.contrib.auth.views.login'),
(r'^logout/$', 'django.contrib.auth.views.logout'),
(r'^login_another/$', 'django.contrib.auth.views.logout_then_login'),
(r'^register/$', 'ellington.registration.views.registration.signup'),
(r'^register/(?P<challenge_string>\w{32})/$', 'ellington.registration.views.registration.register_form'),
(r'^profile/$', 'ellington.registration.views.profile.profile'),
(r'^profile/welcome/$', 'ellington.registration.views.profile.profile_welcome'),
(r'^profile/edit/$', 'ellington.registration.views.profile.edit_profile'),
(r'^password_reset/$', 'django.contrib.auth.views.password_reset'),
(r'^password_reset/done/$', 'django.contrib.auth.views.password_reset_done'),
(r'^password_change/$', 'django.contrib.auth.views.password_change'),
(r'^password_change/done/$', 'django.contrib.auth.views.password_change_done'),
)

View File

@@ -667,7 +667,11 @@ def resolve_variable(path, context):
except (TypeError, AttributeError):
try: # list-index lookup
current = current[int(bits[0])]
except (IndexError, ValueError, KeyError):
except (IndexError, # list index out of range
ValueError, # invalid literal for int()
KeyError, # current is a dict without `int(bits[0])` key
TypeError, # unsubscriptable object
):
raise VariableDoesNotExist("Failed lookup for key [%s] in %r", (bits[0], current)) # missing attribute
except Exception, e:
if getattr(e, 'silent_variable_failure', False):

View File

@@ -17,6 +17,9 @@ class MergeDict(object):
def __contains__(self, key):
return self.has_key(key)
def __copy__(self):
return self.__class__(*self.dicts)
def get(self, key, default=None):
try:
return self[key]
@@ -43,6 +46,10 @@ class MergeDict(object):
return True
return False
def copy(self):
""" returns a copy of this object"""
return self.__copy__()
class SortedDict(dict):
"A dictionary that keeps its keys in the order in which they're inserted."
def __init__(self, data=None):

View File

@@ -86,10 +86,10 @@ objects in the same way as any other `Django model`_::
myuser.groups.add(group, group,...)
myuser.groups.remove(group, group,...)
myuser.groups.clear()
myuser.permissions = [permission_list]
myuser.permissions.add(permission, permission, ...)
myuser.permissions.remove(permission, permission, ...]
myuser.permissions.clear()
myuser.user_permissions = [permission_list]
myuser.user_permissions.add(permission, permission, ...)
myuser.user_permissions.remove(permission, permission, ...]
myuser.user_permissions.clear()
In addition to those automatic API methods, ``User`` objects have the following
custom methods:

View File

@@ -1621,6 +1621,15 @@ For example, this deletes all ``Entry`` objects with a ``pub_date`` year of
Entry.objects.filter(pub_date__year=2005).delete()
When Django deletes an object, it emulates the behavior of the SQL
constraint ``ON DELETE CASCADE`` -- in other words, any objects which
had foreign keys pointing at the object to be deleted will be deleted
along with it. For example::
b = Blog.objects.get(pk=1)
# This will delete the Blog and all of its Entry objects.
b.delete()
Note that ``delete()`` is the only ``QuerySet`` method that is not exposed on a
``Manager`` itself. This is a safety mechanism to prevent you from accidentally
requesting ``Entry.objects.delete()``, and deleting *all* the entries. If you

View File

@@ -206,6 +206,21 @@ for the polls app, we manually specify a template name for the results view:
``template_name='polls/results.html'``. Otherwise, both views would use the same
template. Note that we use ``dict()`` to return an altered dictionary in place.
.. note:: ``all()`` is lazy
It might look a little frightening to see ``Poll.objects.all()`` being used
in a detail view which only needs one ``Poll`` object, but don't worry;
``Poll.objects.all()`` is actually a special object called a ``QuerySet``,
which is "lazy" and doesn't hit your database until it absolutely has to. By
the time the database query happens, the ``object_detail`` generic view will
have narrowed its scope down to a single object, so the eventual query will
only select one row from the database.
If you'd like to know more about how that works, The Django database API
documentation `explains the lazy nature of QuerySet objects`_.
.. _explains the lazy nature of QuerySet objects: ../db_api/#querysets-are-lazy
In previous parts of the tutorial, the templates have been provided with a context
that contains the ``poll`` and ``latest_poll_list`` context variables. However,
the generic views provide the variables ``object`` and ``object_list`` as context.

View File

@@ -390,6 +390,13 @@ to pass metadata and options to views.
.. _generic views: ../generic_views/
.. _syndication framework: ../syndication/
.. admonition:: Dealing with conflicts
It's possible to have a URL pattern which captures named keyword arguments,
and also passes arguments with the same names in its dictionary of extra
arguments. When this happens, the arguments in the dictionary will be used
instead of the arguments captured in the URL.
Passing extra options to ``include()``
--------------------------------------

View File

@@ -0,0 +1,34 @@
"""
# Tests for stuff in django.utils.datastructures.
>>> from django.utils.datastructures import *
### MergeDict #################################################################
>>> d1 = {'chris':'cool','camri':'cute','cotton':'adorable','tulip':'snuggable', 'twoofme':'firstone'}
>>> d2 = {'chris2':'cool2','camri2':'cute2','cotton2':'adorable2','tulip2':'snuggable2'}
>>> d3 = {'chris3':'cool3','camri3':'cute3','cotton3':'adorable3','tulip3':'snuggable3'}
>>> d4 = {'twoofme':'secondone'}
>>> md = MergeDict( d1,d2,d3 )
>>> md['chris']
'cool'
>>> md['camri']
'cute'
>>> md['twoofme']
'firstone'
>>> md2 = md.copy()
>>> md2['chris']
'cool'
### MultiValueDict ##########################################################
>>> d = MultiValueDict({'name': ['Adrian', 'Simon'], 'position': ['Developer']})
>>> d['name']
'Simon'
>>> d.getlist('name')
['Adrian', 'Simon']
>>> d.get('lastname', 'nonexistent')
'nonexistent'
>>> d.setlist('lastname', ['Holovaty', 'Willison'])
"""

View File

@@ -127,6 +127,29 @@ class Templates(unittest.TestCase):
# Fail silently when accessing a non-simple method
'basic-syntax20': ("{{ var.method2 }}", {"var": SomeClass()}, ("","INVALID")),
# List-index syntax allows a template to access a certain item of a subscriptable object.
'list-index01': ("{{ var.1 }}", {"var": ["first item", "second item"]}, "second item"),
# Fail silently when the list index is out of range.
'list-index02': ("{{ var.5 }}", {"var": ["first item", "second item"]}, ("", "INVALID")),
# Fail silently when the variable is not a subscriptable object.
'list-index03': ("{{ var.1 }}", {"var": None}, ("", "INVALID")),
# Fail silently when variable is a dict without the specified key.
'list-index04': ("{{ var.1 }}", {"var": {}}, ("", "INVALID")),
# Dictionary lookup wins out when dict's key is a string.
'list-index05': ("{{ var.1 }}", {"var": {'1': "hello"}}, "hello"),
# But list-index lookup wins out when dict's key is an int, which
# behind the scenes is really a dictionary lookup (for a dict)
# after converting the key to an int.
'list-index06': ("{{ var.1 }}", {"var": {1: "hello"}}, "hello"),
# Dictionary lookup wins out when there is a string and int version of the key.
'list-index07': ("{{ var.1 }}", {"var": {'1': "hello", 1: "world"}}, "hello"),
# Basic filter usage
'basic-syntax21': ("{{ var|upper }}", {"var": "Django is the greatest!"}, "DJANGO IS THE GREATEST!"),
@@ -167,7 +190,7 @@ class Templates(unittest.TestCase):
'basic-syntax33': (r'1{{ var.method3 }}2', {"var": SomeClass()}, ("12", "1INVALID2")),
# In methods that raise an exception without a "silent_variable_attribute" set to True,
# the exception propogates
# the exception propagates
'basic-syntax34': (r'1{{ var.method4 }}2', {"var": SomeClass()}, SomeOtherException),
# Escaped backslash in argument