Permalink
Browse files

[full-history] Trunk merge from [3577]

git-svn-id: http://code.djangoproject.com/svn/django/branches/full-history@3580 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent b1f4974 commit ca86ceec83044fbfd76d1559b6d2a7da35019c10 Uroš Trebec committed Aug 14, 2006
Showing with 492 additions and 103 deletions.
  1. +4 −0 AUTHORS
  2. +1 −1 django/bin/compile-messages.py
  3. +1 −0 django/conf/global_settings.py
  4. BIN django/conf/locale/ru/LC_MESSAGES/django.mo
  5. +2 −1 django/conf/locale/ru/LC_MESSAGES/django.po
  6. +2 −1 django/conf/project_template/settings.py
  7. +1 −1 django/contrib/admin/media/js/admin/RelatedObjectLookups.js
  8. +28 −0 django/contrib/admin/templates/admin/auth/user/add_form.html
  9. +1 −1 django/contrib/admin/templates/admin/change_form.html
  10. +1 −0 django/contrib/admin/templates/admin/edit_inline_tabular.html
  11. +3 −1 django/contrib/admin/urls.py
  12. +39 −0 django/contrib/admin/views/auth.py
  13. +17 −17 django/contrib/admin/views/doc.py
  14. +1 −1 django/contrib/admin/views/main.py
  15. +22 −0 django/contrib/auth/forms.py
  16. +2 −2 django/contrib/flatpages/README.TXT
  17. +2 −1 django/contrib/sessions/middleware.py
  18. +39 −11 django/core/management.py
  19. +0 −4 django/core/servers/basehttp.py
  20. +33 −17 django/core/urlresolvers.py
  21. +4 −0 django/db/backends/postgresql_psycopg2/base.py
  22. +2 −2 django/db/models/__init__.py
  23. +6 −5 django/db/models/base.py
  24. +1 −1 django/db/models/fields/__init__.py
  25. +2 −2 django/db/models/loading.py
  26. +1 −1 django/db/models/manipulators.py
  27. +9 −6 django/http/__init__.py
  28. +2 −2 django/template/defaultfilters.py
  29. +1 −1 django/template/loaders/filesystem.py
  30. +4 −3 django/views/generic/create_update.py
  31. +11 −10 docs/db-api.txt
  32. +148 −0 docs/documentation.txt
  33. +3 −6 docs/faq.txt
  34. +1 −1 docs/generic_views.txt
  35. +7 −0 docs/model-api.txt
  36. +6 −2 docs/request_response.txt
  37. +11 −0 docs/sessions.txt
  38. +12 −0 docs/settings.txt
  39. +45 −0 docs/url_dispatch.txt
  40. +1 −0 setup.py
  41. +2 −0 tests/modeltests/empty/models.py
  42. +11 −2 tests/modeltests/lookup/models.py
  43. +3 −0 tests/othertests/defaultfilters.py
View
@@ -60,6 +60,7 @@ answer newbie questions, and generally made Django that much better:
Amit Chakradeo <http://amit.chakradeo.net/>
ChaosKCW
Ian Clelland <clelland@gmail.com>
+ crankycoder@gmail.com
Matt Croydon <http://www.postneo.com/>
Jonathan Daugherty (cygnus) <http://www.cprogrammer.org/>
Jason Davies (Esaj) <http://www.jasondavies.com/>
@@ -71,6 +72,7 @@ answer newbie questions, and generally made Django that much better:
gandalf@owca.info
Baishampayan Ghose
martin.glueck@gmail.com
+ Simon Greenhill <dev@simon.net.nz>
Espen Grindhaug <http://grindhaug.org/>
Brant Harris
hipertracker@gmail.com
@@ -124,12 +126,14 @@ answer newbie questions, and generally made Django that much better:
Ivan Sagalaev (Maniac) <http://www.softwaremaniacs.org/>
David Schein
sopel
+ Thomas Steinacher <tom@eggdrop.ch>
Radek Švarz <http://www.svarz.cz/translate/>
Swaroop C H <http://www.swaroopch.info>
Aaron Swartz <http://www.aaronsw.com/>
Tom Tobin
Tom Insam
Joe Topjian <http://joe.terrarum.net/geek/code/python/django/>
+ Karen Tracey <graybark@bellsouth.net>
Amit Upadhyay
Geert Vanderkelen
Milton Waddams
@@ -14,7 +14,7 @@ def compile_messages():
print "this script should be run from the django svn tree or your project or app tree"
sys.exit(1)
- for (dirpath, dirnames, filenames) in os.walk(basedir):
+ for dirpath, dirnames, filenames in os.walk(basedir):
for f in filenames:
if f.endswith('.po'):
sys.stderr.write('processing file %s in %s\n' % (f, dirpath))
@@ -252,6 +252,7 @@
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 ".lawrence.com", or None for standard domain cookie.
+SESSION_COOKIE_SECURE = False # Whether the session cookie should be secure (https:// only).
SESSION_SAVE_EVERY_REQUEST = False # Whether to save the session data on every request.
SESSION_EXPIRE_AT_BROWSER_CLOSE = False # Whether sessions expire when a user closes his browser.
Binary file not shown.
@@ -141,6 +141,7 @@ msgid "score date"
msgstr "счёт времени"
#: contrib/comments/models.py:237
+#, fuzzy
msgid "karma score"
msgstr "Карма счёт"
@@ -735,7 +736,7 @@ msgstr "К сожалению, запрашиваемая вами страни
#: contrib/admin/templates/admin/index.html:17
#, python-format
msgid "Models available in the %(name)s application."
-msgstr "Модели доступны в %(name)s приложении."
+msgstr "Модели доступны в %(name) приложении."
#: contrib/admin/templates/admin/index.html:28
#: contrib/admin/templates/admin/change_form.html:15
@@ -60,8 +60,9 @@
ROOT_URLCONF = '{{ project_name }}.urls'
TEMPLATE_DIRS = (
- # Put strings here, like "/home/html/django_templates".
+ # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
+ # Don't forget to use absolute paths, not relative paths.
)
INSTALLED_APPS = (
@@ -11,7 +11,7 @@ function showRelatedObjectLookupPopup(triggeringLink) {
} else {
href = triggeringLink.href + '?pop=1';
}
- var win = window.open(href, name, 'height=500,width=740,resizable=yes,scrollbars=yes');
+ var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes');
win.focus();
return false;
}
@@ -0,0 +1,28 @@
+{% extends "admin/change_form.html" %}
+{% load i18n %}
+
+{% block after_field_sets %}
+
+<p>{% trans "First, enter a username and password. Then, you'll be able to edit more user options." %}</p>
+
+<fieldset class="module aligned">
+
+<div class="form-row">
+ {{ form.username.html_error_list }}
+ <label for="id_username" class="required">{% trans 'Username' %}:</label> {{ form.username }}
+ <p class="help">{{ username_help_text }}</p>
+</div>
+
+<div class="form-row">
+ {{ form.password1.html_error_list }}
+ <label for="id_password1" class="required">{% trans 'Password' %}:</label> {{ form.password1 }}
+</div>
+
+<div class="form-row">
+ {{ form.password2.html_error_list }}
+ <label for="id_password2" class="required">{% trans 'Password (again)' %}:</label> {{ form.password2 }}
+ <p class="help">{% trans 'Enter the same password as above, for verification.' %}</p>
+</div>
+
+</fieldset>
+{% endblock %}
@@ -21,7 +21,7 @@
{% if has_absolute_url %}<li><a href="../../../r/{{ content_type_id }}/{{ object_id }}/" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif%}
</ul>
{% endif %}{% endif %}
-<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post">{% block form_top %}{% endblock %}
+<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.module_name }}_form">{% block form_top %}{% endblock %}
<div>
{% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
{% if opts.admin.save_on_top %}{% submit_row %}{% endif %}
@@ -7,6 +7,7 @@
<th{{ fw.header_class_attribute }}>{{ fw.field.verbose_name|capfirst|escape }}</th>
{% endif %}
{% endfor %}
+ </tr></thead>
{% for fcw in bound_related_object.form_field_collection_wrappers %}
{% if change %}{% if original_row_needed %}
{% if fcw.obj.original %}
@@ -21,13 +21,15 @@
('^doc/tags/$', 'django.contrib.admin.views.doc.template_tag_index'),
('^doc/filters/$', 'django.contrib.admin.views.doc.template_filter_index'),
('^doc/views/$', 'django.contrib.admin.views.doc.view_index'),
- ('^doc/views/jump/$', 'django.contrib.admin.views.doc.jump_to_view'),
('^doc/views/(?P<view>[^/]+)/$', 'django.contrib.admin.views.doc.view_detail'),
('^doc/models/$', 'django.contrib.admin.views.doc.model_index'),
('^doc/models/(?P<app_label>[^\.]+)\.(?P<model_name>[^/]+)/$', 'django.contrib.admin.views.doc.model_detail'),
# ('^doc/templates/$', 'django.views.admin.doc.template_index'),
('^doc/templates/(?P<template>.*)/$', 'django.contrib.admin.views.doc.template_detail'),
+ # "Add user" -- a special-case view
+ ('^auth/user/add/$', 'django.contrib.admin.views.auth.user_add_stage'),
+
# Add/change/delete/history
('^([^/]+)/([^/]+)/$', 'django.contrib.admin.views.main.change_list'),
('^([^/]+)/([^/]+)/add/$', 'django.contrib.admin.views.main.add_stage'),
@@ -0,0 +1,39 @@
+from django.contrib.auth.forms import UserCreationForm
+from django.contrib.auth.models import User
+from django import forms, template
+from django.shortcuts import render_to_response
+from django.http import HttpResponseRedirect
+
+def user_add_stage(request):
+ manipulator = UserCreationForm()
+ if request.method == 'POST':
+ new_data = request.POST.copy()
+ errors = manipulator.get_validation_errors(new_data)
+ if not errors:
+ new_user = manipulator.save(new_data)
+ msg = _('The %(name)s "%(obj)s" was added successfully.') % {'name': 'user', 'obj': new_user}
+ if request.POST.has_key("_addanother"):
+ request.user.message_set.create(message=msg)
+ return HttpResponseRedirect(request.path)
+ else:
+ request.user.message_set.create(message=msg + ' ' + _("You may edit it again below."))
+ return HttpResponseRedirect('../%s/' % new_user.id)
+ else:
+ errors = new_data = {}
+ form = forms.FormWrapper(manipulator, new_data, errors)
+ return render_to_response('admin/auth/user/add_form.html', {
+ 'title': _('Add user'),
+ 'form': form,
+ 'is_popup': request.REQUEST.has_key('_popup'),
+ 'add': True,
+ 'change': False,
+ 'has_delete_permission': False,
+ 'has_change_permission': True,
+ 'has_file_field': False,
+ 'has_absolute_url': False,
+ 'auto_populated_fields': (),
+ 'bound_field_sets': (),
+ 'first_form_field_id': 'id_username',
+ 'opts': User._meta,
+ 'username_help_text': User._meta.get_field('username').help_text,
+ }, context_instance=template.RequestContext(request))
@@ -43,11 +43,11 @@ def template_tag_index(request):
for tag_name, tag_func in library.tags.items():
title, body, metadata = utils.parse_docstring(tag_func.__doc__)
if title:
- title = utils.parse_rst(title, 'tag', 'tag:' + tag_name)
+ title = utils.parse_rst(title, 'tag', _('tag:') + tag_name)
if body:
- body = utils.parse_rst(body, 'tag', 'tag:' + tag_name)
+ body = utils.parse_rst(body, 'tag', _('tag:') + tag_name)
for key in metadata:
- metadata[key] = utils.parse_rst(metadata[key], 'tag', 'tag:' + tag_name)
+ metadata[key] = utils.parse_rst(metadata[key], 'tag', _('tag:') + tag_name)
if library in template.builtins:
tag_library = None
else:
@@ -74,11 +74,11 @@ def template_filter_index(request):
for filter_name, filter_func in library.filters.items():
title, body, metadata = utils.parse_docstring(filter_func.__doc__)
if title:
- title = utils.parse_rst(title, 'filter', 'filter:' + filter_name)
+ title = utils.parse_rst(title, 'filter', _('filter:') + filter_name)
if body:
- body = utils.parse_rst(body, 'filter', 'filter:' + filter_name)
+ body = utils.parse_rst(body, 'filter', _('filter:') + filter_name)
for key in metadata:
- metadata[key] = utils.parse_rst(metadata[key], 'filter', 'filter:' + filter_name)
+ metadata[key] = utils.parse_rst(metadata[key], 'filter', _('filter:') + filter_name)
if library in template.builtins:
tag_library = None
else:
@@ -132,11 +132,11 @@ def view_detail(request, view):
raise Http404
title, body, metadata = utils.parse_docstring(view_func.__doc__)
if title:
- title = utils.parse_rst(title, 'view', 'view:' + view)
+ title = utils.parse_rst(title, 'view', _('view:') + view)
if body:
- body = utils.parse_rst(body, 'view', 'view:' + view)
+ body = utils.parse_rst(body, 'view', _('view:') + view)
for key in metadata:
- metadata[key] = utils.parse_rst(metadata[key], 'model', 'view:' + view)
+ metadata[key] = utils.parse_rst(metadata[key], 'model', _('view:') + view)
return render_to_response('admin_doc/view_detail.html', {
'name': view,
'summary': title,
@@ -161,14 +161,14 @@ def model_detail(request, app_label, model_name):
try:
app_mod = models.get_app(app_label)
except ImproperlyConfigured:
- raise Http404, "App %r not found" % app_label
+ raise Http404, _("App %r not found") % app_label
model = None
for m in models.get_models(app_mod):
if m._meta.object_name.lower() == model_name:
model = m
break
if model is None:
- raise Http404, "Model %r not found in app %r" % (model_name, app_label)
+ raise Http404, _("Model %r not found in app %r") % (model_name, app_label)
opts = model._meta
@@ -180,7 +180,7 @@ def model_detail(request, app_label, model_name):
if isinstance(field, models.ForeignKey):
data_type = related_object_name = field.rel.to.__name__
app_label = field.rel.to._meta.app_label
- verbose = utils.parse_rst(("the related `%s.%s` object" % (app_label, data_type)), 'model', 'model:' + data_type)
+ verbose = utils.parse_rst((_("the related `%s.%s` object") % (app_label, data_type)), 'model', _('model:') + data_type)
else:
data_type = get_readable_field_data_type(field)
verbose = field.verbose_name
@@ -202,7 +202,7 @@ def model_detail(request, app_label, model_name):
continue
verbose = func.__doc__
if verbose:
- verbose = utils.parse_rst(utils.trim_docstring(verbose), 'model', 'model:' + opts.module_name)
+ verbose = utils.parse_rst(utils.trim_docstring(verbose), 'model', _('model:') + opts.module_name)
fields.append({
'name': func_name,
'data_type': get_return_data_type(func_name),
@@ -211,17 +211,17 @@ def model_detail(request, app_label, model_name):
# Gather related objects
for rel in opts.get_all_related_objects():
- verbose = "related `%s.%s` objects" % (rel.opts.app_label, rel.opts.object_name)
+ verbose = _("related `%s.%s` objects") % (rel.opts.app_label, rel.opts.object_name)
accessor = rel.get_accessor_name()
fields.append({
'name' : "%s.all" % accessor,
'data_type' : 'List',
- 'verbose' : utils.parse_rst("all " + verbose , 'model', 'model:' + opts.module_name),
+ 'verbose' : utils.parse_rst(_("all %s") % verbose , 'model', _('model:') + opts.module_name),
})
fields.append({
'name' : "%s.count" % accessor,
'data_type' : 'Integer',
- 'verbose' : utils.parse_rst("number of " + verbose , 'model', 'model:' + opts.module_name),
+ 'verbose' : utils.parse_rst(_("number of %s") % verbose , 'model', _('model:') + opts.module_name),
})
return render_to_response('admin_doc/model_detail.html', {
@@ -336,7 +336,7 @@ def extract_views_from_urlpatterns(urlpatterns, base=''):
elif hasattr(p, '_get_url_patterns'):
views.extend(extract_views_from_urlpatterns(p.url_patterns, base + p.regex.pattern))
else:
- raise TypeError, "%s does not appear to be a urlpattern object" % p
+ raise TypeError, _("%s does not appear to be a urlpattern object") % p
return views
named_group_matcher = re.compile(r'\(\?P(<\w+>).+?\)')
@@ -263,7 +263,7 @@ def add_stage(request, app_label, model_name, show_delete=False, form_url='', po
post_url_continue += "?_popup=1"
return HttpResponseRedirect(post_url_continue % pk_value)
if request.POST.has_key("_popup"):
- return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, %s, "%s");</script>' % \
+ return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, %r, "%s");</script>' % \
(pk_value, str(new_object).replace('"', '\\"')))
elif request.POST.has_key("_addanother"):
request.user.message_set.create(message=msg + ' ' + (_("You may add another %s below.") % opts.verbose_name))
@@ -5,6 +5,28 @@
from django.core import validators
from django import forms
+class UserCreationForm(forms.Manipulator):
+ "A form that creates a user, with no privileges, from the given username and password."
+ def __init__(self):
+ self.fields = (
+ forms.TextField(field_name='username', length=30, maxlength=30, is_required=True,
+ validator_list=[validators.isAlphaNumeric, self.isValidUsername]),
+ forms.PasswordField(field_name='password1', length=30, maxlength=60, is_required=True),
+ forms.PasswordField(field_name='password2', length=30, maxlength=60, is_required=True,
+ validator_list=[validators.AlwaysMatchesOtherField('password1', "The two password fields didn't match.")]),
+ )
+
+ def isValidUsername(self, field_data, all_data):
+ try:
+ User.objects.get(username=field_data)
+ except User.DoesNotExist:
+ return
+ raise validators.ValidationError, 'A user with that username already exists.'
+
+ def save(self, new_data):
+ "Creates the user."
+ return User.objects.create_user(new_data['username'], '', new_data['password1'])
+
class AuthenticationForm(forms.Manipulator):
"""
Base class for authenticating users. Extend this to get a form that accepts
@@ -2,7 +2,7 @@ This is an optional add-on app, flatpages.
For full documentation, see either of these:
- * The file django/docs/flatpages.txt in the Django distribution
+ * The file docs/flatpages.txt in the Django distribution
* http://www.djangoproject.com/documentation/flatpages/ on the Web
-Both have identical content.
+Both have identical content.
@@ -88,5 +88,6 @@ def process_response(self, request, response):
new_session = Session.objects.save(session_key, request.session._session,
datetime.datetime.now() + datetime.timedelta(seconds=settings.SESSION_COOKIE_AGE))
response.set_cookie(settings.SESSION_COOKIE_NAME, session_key,
- max_age=max_age, expires=expires, domain=settings.SESSION_COOKIE_DOMAIN)
+ max_age=max_age, expires=expires, domain=settings.SESSION_COOKIE_DOMAIN,
+ secure=settings.SESSION_COOKIE_SECURE or None)
return response
Oops, something went wrong. Retry.

0 comments on commit ca86cee

Please sign in to comment.