Black v20

This commit is contained in:
Ludovic Stephan 2020-08-28 18:00:54 +02:00
parent 1d707aad41
commit 0875ef1278
13 changed files with 49 additions and 31 deletions

View file

@ -12,8 +12,9 @@ def forwards_func(apps, schema_editor):
for revente in SpectacleRevente.objects.all():
is_expired = timezone.now() > revente.date_tirage()
is_direct = revente.attribution.spectacle.date >= revente.date and timezone.now() > revente.date + timedelta(
minutes=15
is_direct = (
revente.attribution.spectacle.date >= revente.date
and timezone.now() > revente.date + timedelta(minutes=15)
)
revente.shotgun = is_expired or is_direct
revente.save()

View file

@ -18,5 +18,8 @@ class Migration(migrations.Migration):
"verbose_name_plural": "Profils BDS",
},
),
migrations.RemoveField(model_name="bdsprofile", name="is_buro",),
migrations.RemoveField(
model_name="bdsprofile",
name="is_buro",
),
]

View file

@ -10,5 +10,8 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RemoveField(model_name="bdsprofile", name="certificate_file",),
migrations.RemoveField(
model_name="bdsprofile",
name="certificate_file",
),
]

View file

@ -9,7 +9,7 @@ class StaffRequiredMixin(PermissionRequiredMixin):
class MultipleFormMixin(ContextMixin):
""" Mixin pour gérer plusieurs formulaires dans la même vue.
"""Mixin pour gérer plusieurs formulaires dans la même vue.
Le fonctionnement est relativement identique à celui de
FormMixin, dont la documentation est disponible ici :
https://docs.djangoproject.com/en/3.0/ref/class-based-views/mixins-editing/
@ -97,7 +97,7 @@ class MultipleFormMixin(ContextMixin):
class ProcessMultipleFormView(View):
""" Équivalent de `ProcessFormView` pour plusieurs forms.
"""Équivalent de `ProcessFormView` pour plusieurs forms.
Note : il faut que *tous* les formulaires soient valides pour
qu'ils soient sauvegardés !
"""

View file

@ -13,18 +13,23 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterUniqueTogether(
name="extrafield", unique_together={("event", "name")},
name="extrafield",
unique_together={("event", "name")},
),
migrations.AlterUniqueTogether(
name="extrafieldcontent", unique_together={("field", "registration")},
name="extrafieldcontent",
unique_together={("field", "registration")},
),
migrations.AlterUniqueTogether(
name="option", unique_together={("event", "name")},
name="option",
unique_together={("event", "name")},
),
migrations.AlterUniqueTogether(
name="optionchoice", unique_together={("option", "choice")},
name="optionchoice",
unique_together={("option", "choice")},
),
migrations.AlterUniqueTogether(
name="registration", unique_together={("event", "user")},
name="registration",
unique_together={("event", "user")},
),
]

View file

@ -25,7 +25,8 @@ def make_user(name):
def make_staff_user(name):
view_event_perm = Permission.objects.get(
codename="view_event", content_type__app_label="events",
codename="view_event",
content_type__app_label="events",
)
user = make_user(name)
user.user_permissions.add(view_event_perm)

View file

@ -589,7 +589,8 @@ class ExportMegaParticipantsViewTests(MegaHelperMixin, ViewTestCaseMixin, TestCa
self.assertEqual(r.status_code, 200)
self.assertCSVEqual(
r, [["u2", "", "", "", "", str(self.u2.pk), "", ""]],
r,
[["u2", "", "", "", "", str(self.u2.pk), "", ""]],
)

View file

@ -41,7 +41,9 @@ class Command(MyBaseCommand):
group_chef.save()
group_boy.save()
permissions_chef = Permission.objects.filter(content_type__app_label="kfet",)
permissions_chef = Permission.objects.filter(
content_type__app_label="kfet",
)
permissions_boy = Permission.objects.filter(
content_type__app_label="kfet", codename__in=["is_team", "perform_deposit"]
)

View file

@ -1778,7 +1778,8 @@ class KPsulPerformOperationsViewTests(ViewTestCaseMixin, TestCase):
# Another Article, price=2.5, stock=20, no COF reduction
self.article_no_reduction = Article.objects.create(
category=ArticleCategory.objects.create(
name="Category_no_reduction", has_reduction=False,
name="Category_no_reduction",
has_reduction=False,
),
name="Article_no_reduction",
price=Decimal("2.5"),
@ -3799,7 +3800,8 @@ class KPsulCancelOperationsViewTests(ViewTestCaseMixin, TestCase):
self.assertEqual(self.checkout.balance, Decimal("100.00"))
self.kpsul_consumer_mock.group_send.assert_called_with(
"kfet.kpsul", {"checkouts": [], "articles": []},
"kfet.kpsul",
{"checkouts": [], "articles": []},
)
@mock.patch("django.utils.timezone.now")