Skip to content

Commit 4737e65

Browse files
committed
Reformat files with black
1 parent 72d6f67 commit 4737e65

File tree

3 files changed

+16
-30
lines changed

3 files changed

+16
-30
lines changed

src/wagtail_personalisation/models.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,15 @@ class Segment(ClusterableModel):
7171
max_length=20,
7272
choices=TYPE_CHOICES,
7373
default=TYPE_DYNAMIC,
74-
help_text=mark_safe(
75-
_(
76-
"""
74+
help_text=mark_safe(_("""
7775
</br></br><strong>Dynamic:</strong> Users in this segment will change
7876
as more or less meet the rules specified in the segment.
7977
</br><strong>Static:</strong> If the segment contains only static
8078
compatible rules the segment will contain the members that pass
8179
those rules when the segment is created. Mixed static segments or
8280
those containing entirely non static compatible rules will be
8381
populated using the count variable.
84-
"""
85-
)
86-
),
82+
""")),
8783
)
8884
count = models.PositiveSmallIntegerField(
8985
default=0,
@@ -146,9 +142,11 @@ def __init__(self, *args, **kwargs):
146142
"{}_related".format(rule_model._meta.db_table),
147143
label="{}{}".format(
148144
rule_model._meta.verbose_name,
149-
" ({})".format(_("Static compatible"))
150-
if rule_model.static
151-
else "",
145+
(
146+
" ({})".format(_("Static compatible"))
147+
if rule_model.static
148+
else ""
149+
),
152150
),
153151
)
154152
for rule_model in AbstractBaseRule.__subclasses__()

src/wagtail_personalisation/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ def segment_user_data(request, segment_id):
208208
segment = get_object_or_404(Segment, pk=segment_id)
209209

210210
response = HttpResponse(content_type="text/csv; charset=utf-8")
211-
response[
212-
"Content-Disposition"
213-
] = "attachment;filename=segment-%s-users.csv" % str(segment_id)
211+
response["Content-Disposition"] = (
212+
"attachment;filename=segment-%s-users.csv" % str(segment_id)
213+
)
214214

215215
headers = ["Username"]
216216
for rule in segment.get_rules():

src/wagtail_personalisation/wagtail_hooks.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -296,15 +296,11 @@ def render_html(self, parent_context):
296296
segment_count = models.Segment.objects.count()
297297
target_url = reverse("wagtail_personalisation_segment_modeladmin_index")
298298
title = _("Segments")
299-
return mark_safe(
300-
"""
299+
return mark_safe("""
301300
<li>
302301
<svg class="icon icon-tag icon" aria-hidden="true"><use href="#icon-tag"></use></svg>
303302
<a href="{}"><span>{}</span> {}</a>
304-
</li>""".format(
305-
target_url, segment_count, title
306-
)
307-
)
303+
</li>""".format(target_url, segment_count, title))
308304

309305

310306
class PersonalisedPagesSummaryPanel(PagesSummaryItem):
@@ -315,15 +311,11 @@ def render_html(self, parent_context):
315311
segment__isnull=True
316312
).count()
317313
title = _("Personalised Page")
318-
return mark_safe(
319-
"""
314+
return mark_safe("""
320315
<li>
321316
<svg class="icon icon-doc-empty icon" aria-hidden="true"><use href="#icon-doc-empty"></use></svg>
322317
<a><span>{}</span> {}{}</a>
323-
</li>""".format(
324-
page_count, title, pluralize(page_count)
325-
)
326-
)
318+
</li>""".format(page_count, title, pluralize(page_count)))
327319

328320

329321
class VariantPagesSummaryPanel(PagesSummaryItem):
@@ -334,16 +326,12 @@ def render_html(self, parent_context):
334326
segment__isnull=False
335327
).count()
336328
title = _("Variant")
337-
return mark_safe(
338-
"""
329+
return mark_safe("""
339330
<li>
340331
<svg class="icon icon-doc-empty icon" aria-hidden="true">\n
341332
<use href="#icon-doc-empty"></use></svg>
342333
<a><span>{}</span> {}{}</a>
343-
</li>""".format(
344-
page_count, title, pluralize(page_count)
345-
)
346-
)
334+
</li>""".format(page_count, title, pluralize(page_count)))
347335

348336

349337
@hooks.register("construct_homepage_summary_items")

0 commit comments

Comments
 (0)