From 69373f3420d28597332a72269b5fae721cc6ae19 Mon Sep 17 00:00:00 2001 From: Chris Streeter Date: Sat, 2 Mar 2013 21:48:34 -0800 Subject: [PATCH 01/63] Fixed #19925 - Added validation for REQUIRED_FIELDS being a list Thanks Roman Alexander for the suggestion. --- AUTHORS | 1 + django/contrib/auth/tests/test_custom_user.py | 12 ++++++++++++ django/contrib/auth/tests/test_management.py | 7 +++++++ django/core/management/validation.py | 4 ++++ 4 files changed, 24 insertions(+) diff --git a/AUTHORS b/AUTHORS index 80f277996b..cedff32fe0 100644 --- a/AUTHORS +++ b/AUTHORS @@ -550,6 +550,7 @@ answer newbie questions, and generally made Django that much better: Thomas Steinacher Emil Stenström Johan C. Stöver + Chris Streeter Nowell Strite Thomas Stromberg Hannes Struß diff --git a/django/contrib/auth/tests/test_custom_user.py b/django/contrib/auth/tests/test_custom_user.py index a3a159880a..0f6ebbda55 100644 --- a/django/contrib/auth/tests/test_custom_user.py +++ b/django/contrib/auth/tests/test_custom_user.py @@ -156,6 +156,18 @@ class CustomUserNonUniqueUsername(AbstractBaseUser): app_label = 'auth' +class CustomUserNonListRequiredFields(AbstractBaseUser): + "A user with a non-list REQUIRED_FIELDS" + username = models.CharField(max_length=30, unique=True) + date_of_birth = models.DateField() + + USERNAME_FIELD = 'username' + REQUIRED_FIELDS = 'date_of_birth' + + class Meta: + app_label = 'auth' + + class CustomUserBadRequiredFields(AbstractBaseUser): "A user with a non-unique username" username = models.CharField(max_length=30, unique=True) diff --git a/django/contrib/auth/tests/test_management.py b/django/contrib/auth/tests/test_management.py index fee0a29e7b..6c3718465d 100644 --- a/django/contrib/auth/tests/test_management.py +++ b/django/contrib/auth/tests/test_management.py @@ -174,6 +174,13 @@ class CreatesuperuserManagementCommandTestCase(TestCase): class CustomUserModelValidationTestCase(TestCase): + @override_settings(AUTH_USER_MODEL='auth.CustomUserNonListRequiredFields') + def test_required_fields_is_list(self): + "REQUIRED_FIELDS should be a list." + new_io = StringIO() + get_validation_errors(new_io, get_app('auth')) + self.assertIn("The REQUIRED_FIELDS must be a list or tuple.", new_io.getvalue()) + @override_settings(AUTH_USER_MODEL='auth.CustomUserBadRequiredFields') def test_username_not_in_required_fields(self): "USERNAME_FIELD should not appear in REQUIRED_FIELDS." diff --git a/django/core/management/validation.py b/django/core/management/validation.py index a6d6a76985..a64c6e815c 100644 --- a/django/core/management/validation.py +++ b/django/core/management/validation.py @@ -51,6 +51,10 @@ def get_validation_errors(outfile, app=None): # If this is the current User model, check known validation problems with User models if settings.AUTH_USER_MODEL == '%s.%s' % (opts.app_label, opts.object_name): + # Check that REQUIRED_FIELDS is a list + if not isinstance(cls.REQUIRED_FIELDS, (list, tuple)): + e.add(opts, 'The REQUIRED_FIELDS must be a list or tuple.') + # Check that the USERNAME FIELD isn't included in REQUIRED_FIELDS. if cls.USERNAME_FIELD in cls.REQUIRED_FIELDS: e.add(opts, 'The field named as the USERNAME_FIELD should not be included in REQUIRED_FIELDS on a swappable User model.') From f80b1063e404d28779a7c78cfd616fd416a2ef10 Mon Sep 17 00:00:00 2001 From: russkel Date: Sat, 8 Jun 2013 14:53:27 +0900 Subject: [PATCH 02/63] Update submitting-patches.txt Few quick fixes to the terminology in order to match what is used on the Django Trac at the moment. --- .../contributing/writing-code/submitting-patches.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/internals/contributing/writing-code/submitting-patches.txt b/docs/internals/contributing/writing-code/submitting-patches.txt index ed8aad99b3..8f8ddddab4 100644 --- a/docs/internals/contributing/writing-code/submitting-patches.txt +++ b/docs/internals/contributing/writing-code/submitting-patches.txt @@ -37,7 +37,7 @@ and time availability), claim it by following these steps: `ticket tracker`_. * If a ticket for this issue already exists, make sure nobody else has - claimed it. To do this, look at the "Assigned to" section of the ticket. + claimed it. To do this, look at the "Owned by" section of the ticket. If it's assigned to "nobody," then it's available to be claimed. Otherwise, somebody else is working on this ticket, and you either find another bug/feature to work on, or contact the developer working on the @@ -48,7 +48,7 @@ and time availability), claim it by following these steps: * Claim the ticket: - 1. click the "accept" radio button under "Action" near the bottom of the + 1. click the "assign to myself" radio button under "Action" near the bottom of the page, 2. then click "Submit changes." From 6a092f24e01b6448f4e5601968db82720c9397de Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 8 Jun 2013 15:05:50 +0200 Subject: [PATCH 03/63] Allow build of translated documentation --- docs/Makefile | 3 ++- docs/conf.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/Makefile b/docs/Makefile index 2a8bcd7101..a2c926c7ea 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -6,11 +6,12 @@ SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build +LANGUAGE = # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -n -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +ALLSPHINXOPTS = -n -d $(BUILDDIR)/doctrees -D language=$(LANGUAGE) $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . diff --git a/docs/conf.py b/docs/conf.py index a01ddb60b8..feff99b6f4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -77,6 +77,9 @@ django_next_version = '1.6' # for a list of supported languages. #language = None +# Location for .po/.mo translation files used when language is set +locale_dirs = ['locale/'] + # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' From 706eced9bb9012788494c14566577ed691924e82 Mon Sep 17 00:00:00 2001 From: Camilo Nova Date: Sat, 8 Jun 2013 10:45:39 -0500 Subject: [PATCH 04/63] Update flatpages.txt Fixed typo --- docs/ref/contrib/flatpages.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/ref/contrib/flatpages.txt b/docs/ref/contrib/flatpages.txt index 292b304acb..cff3f680d4 100644 --- a/docs/ref/contrib/flatpages.txt +++ b/docs/ref/contrib/flatpages.txt @@ -47,7 +47,7 @@ Then either: 3. Add an entry in your URLconf. For example:: urlpatterns = patterns('', - ('^pages/', include('django.contrib.flatpages.urls')), + (r'^pages/', include('django.contrib.flatpages.urls')), ) or: @@ -74,7 +74,7 @@ There are several ways to include the flat pages in your URLconf. You can dedicate a particular path to flat pages:: urlpatterns = patterns('', - ('^pages/', include('django.contrib.flatpages.urls')), + (r'^pages/', include('django.contrib.flatpages.urls')), ) You can also set it up as a "catchall" pattern. In this case, it is important From 4bd6e5e89501680235ded6c460657a1231231931 Mon Sep 17 00:00:00 2001 From: Kenny Rachuonyo Date: Sun, 9 Jun 2013 08:23:48 +0300 Subject: [PATCH 05/63] Update media.txt Fixed typo: froms -> forms --- docs/topics/forms/media.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/topics/forms/media.txt b/docs/topics/forms/media.txt index b014e97119..a1fd533241 100644 --- a/docs/topics/forms/media.txt +++ b/docs/topics/forms/media.txt @@ -49,7 +49,7 @@ define the media requirements. Here's a simple example:: - from django import froms + from django import forms class CalendarWidget(forms.TextInput): class Media: From 79ff1aedd57a154a7563fb1b71c3e7997c513408 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Sun, 9 Jun 2013 14:31:04 +0200 Subject: [PATCH 06/63] Replaced a dict emulating a set with a set. --- django/db/models/loading.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django/db/models/loading.py b/django/db/models/loading.py index 4372873e50..5ad2f12ba0 100644 --- a/django/db/models/loading.py +++ b/django/db/models/loading.py @@ -39,7 +39,7 @@ class AppCache(object): # -- Everything below here is only used when populating the cache -- loaded=False, - handled={}, + handled=set(), postponed=[], nesting_level=0, _get_models_cache={}, @@ -89,7 +89,7 @@ class AppCache(object): Loads the app with the provided fully qualified name, and returns the model module. """ - self.handled[app_name] = None + self.handled.add(app_name) self.nesting_level += 1 app_module = import_module(app_name) try: From 175a102ddceae2ebd1a4e03916a23adafc35bda5 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Thu, 6 Jun 2013 14:15:26 -0400 Subject: [PATCH 07/63] Fixed #20567 - Documented BoundField.id_for_label. Thanks littlepig for the suggestion. --- docs/ref/forms/api.txt | 23 +++++++++++++++++++++++ docs/ref/forms/widgets.txt | 5 ++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt index 67e3aab712..c05430c64e 100644 --- a/docs/ref/forms/api.txt +++ b/docs/ref/forms/api.txt @@ -688,6 +688,29 @@ by a ``Widget``:: >>> print(bound_form['subject'].value()) hi +.. attribute:: BoundField.id_for_label + +Use this property to render the ID of this field. For example, if you are +manually constructing a ``