Loading django/contrib/admin/filters.py +6 −6 Original line number Diff line number Diff line Loading @@ -179,9 +179,9 @@ class RelatedFieldListFilter(FieldListFilter): self.title = self.lookup_title def has_output(self): if (isinstance(self.field, models.related.RelatedObject) and self.field.field.null or hasattr(self.field, 'rel') and self.field.null): if (isinstance(self.field, models.related.RelatedObject) and self.field.field.null or hasattr(self.field, 'rel') and self.field.null): extra = 1 else: extra = 0 Loading @@ -206,9 +206,9 @@ class RelatedFieldListFilter(FieldListFilter): }, [self.lookup_kwarg_isnull]), 'display': val, } if (isinstance(self.field, models.related.RelatedObject) and self.field.field.null or hasattr(self.field, 'rel') and self.field.null): if (isinstance(self.field, models.related.RelatedObject) and self.field.field.null or hasattr(self.field, 'rel') and self.field.null): yield { 'selected': bool(self.lookup_val_isnull), 'query_string': cl.get_query_string({ Loading django/contrib/admin/templatetags/admin_modify.py +1 −2 Original line number Diff line number Diff line Loading @@ -32,8 +32,7 @@ def submit_row(context): save_as = context['save_as'] ctx = { 'opts': opts, 'show_delete_link': (not is_popup and context['has_delete_permission'] and change and context.get('show_delete', True)), 'show_delete_link': not is_popup and context['has_delete_permission'] and change and context.get('show_delete', True), 'show_save_as_new': not is_popup and change and save_as, 'show_save_and_add_another': context['has_add_permission'] and not is_popup and (not save_as or context['add']), 'show_save_and_continue': not is_popup and context['has_change_permission'], Loading django/contrib/admin/widgets.py +11 −8 Original line number Diff line number Diff line Loading @@ -153,10 +153,13 @@ class ForeignKeyRawIdWidget(forms.TextInput): extra = [] if rel_to in self.admin_site._registry: # The related object is registered with the same AdminSite related_url = reverse('admin:%s_%s_changelist' % (rel_to._meta.app_label, rel_to._meta.model_name), current_app=self.admin_site.name) related_url = reverse( 'admin:%s_%s_changelist' % ( rel_to._meta.app_label, rel_to._meta.model_name, ), current_app=self.admin_site.name, ) params = self.url_parameters() if params: Loading @@ -167,10 +170,10 @@ class ForeignKeyRawIdWidget(forms.TextInput): attrs['class'] = 'vForeignKeyRawIdAdminField' # The JavaScript code looks for this hook. # TODO: "lookup_id_" is hard-coded here. This should instead use # the correct API to determine the ID dynamically. extra.append('<a href="%s%s" class="related-lookup" id="lookup_id_%s" onclick="return showRelatedObjectLookupPopup(this);"> ' % (related_url, url, name)) extra.append('<img src="%s" width="16" height="16" alt="%s" /></a>' % (static('admin/img/selector-search.gif'), _('Lookup'))) extra.append('<a href="%s%s" class="related-lookup" id="lookup_id_%s" onclick="return showRelatedObjectLookupPopup(this);"> ' % (related_url, url, name)) extra.append('<img src="%s" width="16" height="16" alt="%s" /></a>' % (static('admin/img/selector-search.gif'), _('Lookup'))) output = [super(ForeignKeyRawIdWidget, self).render(name, value, attrs)] + extra if value: output.append(self.label_for_value(value)) Loading django/contrib/auth/tests/test_models.py +5 −3 Original line number Diff line number Diff line Loading @@ -69,9 +69,11 @@ class UserManagerTestCase(TestCase): self.assertEqual(returned, 'email\ with_whitespace@d.com') def test_empty_username(self): self.assertRaisesMessage(ValueError, self.assertRaisesMessage( ValueError, 'The given username must be set', User.objects.create_user, username='') User.objects.create_user, username='' ) class AbstractUserTestCase(TestCase): Loading django/contrib/gis/geos/libgeos.py +5 −3 Original line number Diff line number Diff line Loading @@ -48,9 +48,11 @@ if lib_names: # No GEOS library could be found. if lib_path is None: raise ImportError('Could not find the GEOS library (tried "%s"). ' raise ImportError( 'Could not find the GEOS library (tried "%s"). ' 'Try setting GEOS_LIBRARY_PATH in your settings.' % '", "'.join(lib_names)) '", "'.join(lib_names) ) # Getting the GEOS C library. The C interface (CDLL) is used for # both *NIX and Windows. Loading Loading
django/contrib/admin/filters.py +6 −6 Original line number Diff line number Diff line Loading @@ -179,9 +179,9 @@ class RelatedFieldListFilter(FieldListFilter): self.title = self.lookup_title def has_output(self): if (isinstance(self.field, models.related.RelatedObject) and self.field.field.null or hasattr(self.field, 'rel') and self.field.null): if (isinstance(self.field, models.related.RelatedObject) and self.field.field.null or hasattr(self.field, 'rel') and self.field.null): extra = 1 else: extra = 0 Loading @@ -206,9 +206,9 @@ class RelatedFieldListFilter(FieldListFilter): }, [self.lookup_kwarg_isnull]), 'display': val, } if (isinstance(self.field, models.related.RelatedObject) and self.field.field.null or hasattr(self.field, 'rel') and self.field.null): if (isinstance(self.field, models.related.RelatedObject) and self.field.field.null or hasattr(self.field, 'rel') and self.field.null): yield { 'selected': bool(self.lookup_val_isnull), 'query_string': cl.get_query_string({ Loading
django/contrib/admin/templatetags/admin_modify.py +1 −2 Original line number Diff line number Diff line Loading @@ -32,8 +32,7 @@ def submit_row(context): save_as = context['save_as'] ctx = { 'opts': opts, 'show_delete_link': (not is_popup and context['has_delete_permission'] and change and context.get('show_delete', True)), 'show_delete_link': not is_popup and context['has_delete_permission'] and change and context.get('show_delete', True), 'show_save_as_new': not is_popup and change and save_as, 'show_save_and_add_another': context['has_add_permission'] and not is_popup and (not save_as or context['add']), 'show_save_and_continue': not is_popup and context['has_change_permission'], Loading
django/contrib/admin/widgets.py +11 −8 Original line number Diff line number Diff line Loading @@ -153,10 +153,13 @@ class ForeignKeyRawIdWidget(forms.TextInput): extra = [] if rel_to in self.admin_site._registry: # The related object is registered with the same AdminSite related_url = reverse('admin:%s_%s_changelist' % (rel_to._meta.app_label, rel_to._meta.model_name), current_app=self.admin_site.name) related_url = reverse( 'admin:%s_%s_changelist' % ( rel_to._meta.app_label, rel_to._meta.model_name, ), current_app=self.admin_site.name, ) params = self.url_parameters() if params: Loading @@ -167,10 +170,10 @@ class ForeignKeyRawIdWidget(forms.TextInput): attrs['class'] = 'vForeignKeyRawIdAdminField' # The JavaScript code looks for this hook. # TODO: "lookup_id_" is hard-coded here. This should instead use # the correct API to determine the ID dynamically. extra.append('<a href="%s%s" class="related-lookup" id="lookup_id_%s" onclick="return showRelatedObjectLookupPopup(this);"> ' % (related_url, url, name)) extra.append('<img src="%s" width="16" height="16" alt="%s" /></a>' % (static('admin/img/selector-search.gif'), _('Lookup'))) extra.append('<a href="%s%s" class="related-lookup" id="lookup_id_%s" onclick="return showRelatedObjectLookupPopup(this);"> ' % (related_url, url, name)) extra.append('<img src="%s" width="16" height="16" alt="%s" /></a>' % (static('admin/img/selector-search.gif'), _('Lookup'))) output = [super(ForeignKeyRawIdWidget, self).render(name, value, attrs)] + extra if value: output.append(self.label_for_value(value)) Loading
django/contrib/auth/tests/test_models.py +5 −3 Original line number Diff line number Diff line Loading @@ -69,9 +69,11 @@ class UserManagerTestCase(TestCase): self.assertEqual(returned, 'email\ with_whitespace@d.com') def test_empty_username(self): self.assertRaisesMessage(ValueError, self.assertRaisesMessage( ValueError, 'The given username must be set', User.objects.create_user, username='') User.objects.create_user, username='' ) class AbstractUserTestCase(TestCase): Loading
django/contrib/gis/geos/libgeos.py +5 −3 Original line number Diff line number Diff line Loading @@ -48,9 +48,11 @@ if lib_names: # No GEOS library could be found. if lib_path is None: raise ImportError('Could not find the GEOS library (tried "%s"). ' raise ImportError( 'Could not find the GEOS library (tried "%s"). ' 'Try setting GEOS_LIBRARY_PATH in your settings.' % '", "'.join(lib_names)) '", "'.join(lib_names) ) # Getting the GEOS C library. The C interface (CDLL) is used for # both *NIX and Windows. Loading