Skip to content

Commit 076631c

Browse files
committed
flake8 fixes
1 parent b2a7f6f commit 076631c

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

polymorphic_tree/admin/parentadmin.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,17 @@ def get_action_icons(self, node):
118118
actions = []
119119
if node.can_have_children:
120120
actions.append(
121-
u'<a href="add/?{parent_attr}={id}" title="{title}" class="add-child-object"><img src="{static}polymorphic_tree/icons/page_new.gif" width="16" height="16" alt="{title}" /></a>'.format(
121+
u'<a href="add/?{parent_attr}={id}" title="{title}" class="add-child-object">'
122+
u'<img src="{static}polymorphic_tree/icons/page_new.gif" width="16" height="16" alt="{title}" /></a>'.format(
122123
parent_attr=self.model._mptt_meta.parent_attr, id=node.pk, title=_('Add sub node'), static=settings.STATIC_URL)
123124
)
124125
else:
125126
actions.append(self.EMPTY_ACTION_ICON.format(STATIC_URL=settings.STATIC_URL, css_class='add-child-object'))
126127

127128
if self.can_preview_object(node):
128129
actions.append(
129-
u'<a href="{url}" title="{title}" target="_blank"><img src="{static}polymorphic_tree/icons/world.gif" width="16" height="16" alt="{title}" /></a>'.format(
130+
u'<a href="{url}" title="{title}" target="_blank">'
131+
u'<img src="{static}polymorphic_tree/icons/world.gif" width="16" height="16" alt="{title}" /></a>'.format(
130132
url=node.get_absolute_url(), title=_('View on site'), static=settings.STATIC_URL)
131133
)
132134

polymorphic_tree/models.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class PolymorphicMPTTModelBase(MPTTModelBase, PolymorphicModelBase):
3535
Metaclass for all polymorphic models.
3636
Needed to support both MPTT and Polymorphic metaclasses.
3737
"""
38-
pass
3938

4039

4140
class PolymorphicTreeForeignKey(TreeForeignKey):
@@ -134,7 +133,8 @@ class Meta:
134133
ordering = ('tree_id', 'lft',)
135134

136135
# Define:
137-
# parent = PolymorphicTreeForeignKey('self', blank=True, null=True, related_name='children', verbose_name=_('parent'), help_text=_('You can also change the parent by dragging the item in the list.'))
136+
# parent = PolymorphicTreeForeignKey('self', blank=True, null=True, related_name='children', verbose_name=_('parent'),
137+
# help_text=_('You can also change the parent by dragging the item in the list.'))
138138
# class MPTTMeta:
139139
# order_insertion_by = 'title'
140140

@@ -203,7 +203,6 @@ def validate_move_to(self, new_parent):
203203
To deny move, this method have to be raised ``ValidationError`` or
204204
``InvalidMove`` from ``mptt.exceptions``
205205
"""
206-
pass
207206

208207

209208
def _get_new_parent(moved, target, position='first-child'):

polymorphic_tree/templatetags/stylable_admin_list.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def _get_mptt_indent_field(cl, result):
200200
mptt_indent_field = None
201201
for field_name in cl.list_display:
202202
try:
203-
f = cl.lookup_opts.get_field(field_name)
203+
cl.lookup_opts.get_field(field_name)
204204
except models.FieldDoesNotExist:
205205
if mptt_indent_field is None:
206206
attr = getattr(result, field_name, None)
@@ -244,7 +244,7 @@ def _get_non_field_repr(cl, result, field_name):
244244
if callable(field_name):
245245
attr = field_name
246246
value = attr(result)
247-
elif hasattr(cl.model_admin, field_name) and not field_name in ('__str__', '__unicode__'):
247+
elif hasattr(cl.model_admin, field_name) and field_name not in ('__str__', '__unicode__'):
248248
attr = getattr(cl.model_admin, field_name)
249249
value = attr(result)
250250
else:

polymorphic_tree/tests/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
# allow test runners in Django < 1.7 to find the tests
44
if django.VERSION[:2] < (1, 7):
5-
from .test_models import *
5+
from .test_models import * # noqa

setup.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
[wheel]
22
# create "py2.py3-none-any.whl" package
33
universal = 1
4+
5+
[flake8]
6+
exclude=polymorphic_tree/migrations/*.py, polymorphic_tree/tests/test_models.py
7+
max-line-length=160

0 commit comments

Comments
 (0)