mirror of
https://github.com/ae-utbm/sith.git
synced 2025-04-16 02:50:22 +00:00
commit
3d40e92958
@ -27,7 +27,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<fieldset class="required margin-bottom">
|
<fieldset class="required margin-bottom">
|
||||||
{% for field_name in form.admin_fields %}
|
{% for field_name in form.admin_fields %}
|
||||||
{% set field = form.pop(field_name) %}
|
{% set field = form[field_name] %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
{{ field.errors }}
|
{{ field.errors }}
|
||||||
{{ field.label_tag() }}
|
{{ field.label_tag() }}
|
||||||
|
@ -918,3 +918,14 @@ def test_club_board_member_cannot_edit_club_properties(client: Client):
|
|||||||
assert club.name == "old name"
|
assert club.name == "old name"
|
||||||
assert club.is_active
|
assert club.is_active
|
||||||
assert club.address == "new address"
|
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
|
||||||
|
@ -1,23 +1,7 @@
|
|||||||
# Generated by Django 4.2.17 on 2025-03-05 14:03
|
# Generated by Django 4.2.17 on 2025-03-05 14:03
|
||||||
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
|
||||||
from django.db import migrations, models
|
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):
|
class Migration(migrations.Migration):
|
||||||
@ -119,8 +103,5 @@ class Migration(migrations.Migration):
|
|||||||
name="returnable_product_unique_type_per_customer",
|
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"),
|
migrations.RemoveField(model_name="customer", name="recorded_products"),
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user