autopep8, except line length

fix_request_path_info
Diederik van der Boor 2016-12-19 11:10:03 +01:00
parent 695d352edb
commit 1d13b4f3c5
6 changed files with 7 additions and 9 deletions

View File

@ -167,7 +167,6 @@ class PolymorphicChildModelAdmin(admin.ModelAdmin):
context.update(extra_context)
return super(PolymorphicChildModelAdmin, self).history_view(request, object_id, extra_context=context)
# ---- Extra: improving the form/fieldset default display ----
def get_fieldsets(self, request, obj=None):

View File

@ -11,6 +11,7 @@ class GenericPolymorphicFormSetChild(PolymorphicFormSetChild):
"""
Formset child for generic inlines
"""
def __init__(self, *args, **kwargs):
self.ct_field = kwargs.pop('ct_field', 'content_type')
self.fk_field = kwargs.pop('fk_field', 'object_id')

View File

@ -2,6 +2,7 @@
Internal utils
"""
def add_media(dest, media):
"""
Optimized version of django.forms.Media.__add__() that doesn't create new objects.

View File

@ -472,4 +472,3 @@ class PolymorphicQuerySet(QuerySet):
return olist
clist = PolymorphicQuerySet._p_list_class(olist)
return clist

View File

@ -110,7 +110,6 @@ def translate_polymorphic_filter_definitions_in_args(queryset_model, args, using
return [translate_polymorphic_Q_object(queryset_model, q, using=using) for q in q_objects]
def _translate_polymorphic_filter_definition(queryset_model, field_path, field_val, using=DEFAULT_DB_ALIAS):
"""
Translate a keyword argument (field_path=field_val), as used for
@ -271,4 +270,3 @@ def _create_model_filter_Q(modellist, not_instance_of=False, using=DEFAULT_DB_AL
if not_instance_of:
q_ored = ~q_ored
return q_ored

View File

@ -432,6 +432,7 @@ class PolymorphicTests(TestCase):
"""
The test suite
"""
def test_annotate_aggregate_order(self):
# create a blog of type BlogA
# create two blog entries in BlogA
@ -630,7 +631,6 @@ class PolymorphicTests(TestCase):
self.assertEqual(repr(objects_only_field4[3]),
'<Model2D: id 4, field1 (CharField), field2 (CharField), field3 (CharField), field4 (CharField), deferred[field4]>')
def test_manual_get_real_instance(self):
self.create_model2abcd()
@ -1161,7 +1161,7 @@ class PolymorphicTests(TestCase):
lambda: Model2A.objects.aggregate(Count('Model2B___field2'))
)
@skipIf(django.VERSION < (1,8,), "This test needs Django >=1.8")
@skipIf(django.VERSION < (1, 8,), "This test needs Django >=1.8")
def test_polymorphic__complex_aggregate(self):
""" test (complex expression on) aggregate (should work for annotate either) """
@ -1180,14 +1180,14 @@ class PolymorphicTests(TestCase):
# we have to set the defaul alias or django won't except a complex expression
# on aggregate/annotate
def ComplexAgg(expression):
complexagg = Count(expression)*10
complexagg = Count(expression) * 10
complexagg.default_alias = 'complexagg'
return complexagg
with self.assertRaisesMessage(AssertionError, 'PolymorphicModel: annotate()/aggregate(): ___ model lookup supported for keyword arguments only'):
Model2A.objects.aggregate(ComplexAgg('Model2B___field2'))
@skipIf(django.VERSION < (1,8,), "This test needs Django >=1.8")
@skipIf(django.VERSION < (1, 8,), "This test needs Django >=1.8")
def test_polymorphic__expressions(self):
from django.db.models.functions import Concat
@ -1239,7 +1239,7 @@ class RegressionTests(TestCase):
class MultipleDatabasesTests(TestCase):
multi_db = True
@skipIf(django.VERSION < (1,5,), "This test needs Django >=1.5")
@skipIf(django.VERSION < (1, 5,), "This test needs Django >=1.5")
def test_save_to_non_default_database(self):
Model2A.objects.db_manager('secondary').create(field1='A1')
Model2C(field1='C1', field2='C2', field3='C3').save(using='secondary')