diff --git a/club/templates/club/edit_club.jinja b/club/templates/club/edit_club.jinja index 2964fb64..d70e2140 100644 --- a/club/templates/club/edit_club.jinja +++ b/club/templates/club/edit_club.jinja @@ -27,7 +27,7 @@

{% for field_name in form.admin_fields %} - {% set field = form.pop(field_name) %} + {% set field = form[field_name] %}
{{ field.errors }} {{ field.label_tag() }} diff --git a/club/tests.py b/club/tests.py index 72dd8214..217f29f6 100644 --- a/club/tests.py +++ b/club/tests.py @@ -918,3 +918,14 @@ def test_club_board_member_cannot_edit_club_properties(client: Client): assert club.name == "old name" assert club.is_active assert club.address == "new address" + + +@pytest.mark.django_db +def test_edit_club_page_doesnt_crash(client: Client): + """crash test for club:club_edit""" + club = baker.make(Club) + user = subscriber_user.make() + baker.make(Membership, club=club, user=user, role=3) + client.force_login(user) + res = client.get(reverse("club:club_edit", kwargs={"club_id": club.id})) + assert res.status_code == 200 diff --git a/counter/migrations/0030_returnableproduct_returnableproductbalance_and_more.py b/counter/migrations/0030_returnableproduct_returnableproductbalance_and_more.py index 0ec3d95e..82378636 100644 --- a/counter/migrations/0030_returnableproduct_returnableproductbalance_and_more.py +++ b/counter/migrations/0030_returnableproduct_returnableproductbalance_and_more.py @@ -1,23 +1,7 @@ # Generated by Django 4.2.17 on 2025-03-05 14:03 import django.db.models.deletion -from django.conf import settings from django.db import migrations, models -from django.db.migrations.state import StateApps - - -def migrate_cons_balances(apps: StateApps, schema_editor): - ReturnableProduct = apps.get_model("counter", "ReturnableProduct") - Product = apps.get_model("counter", "Product") - - cons = Product.objects.filter(pk=settings.SITH_ECOCUP_CONS).first() - dcons = Product.objects.filter(pk=settings.SITH_ECOCUP_DECO).first() - if not cons or not dcons: - return - returnable = ReturnableProduct.objects.create( - product=cons, returned_product=dcons, max_return=settings.SITH_ECOCUP_LIMIT - ) - returnable.update_balances() class Migration(migrations.Migration): @@ -119,8 +103,5 @@ class Migration(migrations.Migration): name="returnable_product_unique_type_per_customer", ), ), - migrations.RunPython( - migrate_cons_balances, reverse_code=migrations.RunPython.noop, elidable=True - ), migrations.RemoveField(model_name="customer", name="recorded_products"), ]