1
0

Tobacco is in stock by default, make voting lockable

This commit is contained in:
Marcel Schwarz 2022-08-17 17:13:40 +02:00
parent c7a661da05
commit ba56e79887
4 changed files with 34 additions and 7 deletions

View File

@ -43,8 +43,8 @@ class EventDateInline(admin.StackedInline):
@admin.register(ClubhausEvent)
class ClubhausEventAdmin(admin.ModelAdmin):
list_display = ("id", "name", "date", "active")
list_editable = ('active',)
list_display = ("id", "name", "date", "active", "voting_locked")
list_editable = ('active', "voting_locked")
ordering = ("date",)
inlines = [
EventDateInline

View File

@ -0,0 +1,23 @@
# Generated by Django 4.0.7 on 2022-08-17 15:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0018_eventdatevotes_available'),
]
operations = [
migrations.AddField(
model_name='clubhausevent',
name='voting_locked',
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name='tobacco',
name='in_stock',
field=models.BooleanField(default=True),
),
]

View File

@ -15,7 +15,7 @@ class Tobacco(models.Model):
name = models.CharField(max_length=200, unique=True, blank=False, null=False)
description = models.TextField(blank=True, null=False)
category = models.ForeignKey("TobaccoCategory", on_delete=models.CASCADE, blank=False, null=False)
in_stock = models.BooleanField()
in_stock = models.BooleanField(default=True)
picture = models.ImageField(upload_to="tobacco_images/", null=False, blank=True)
def __str__(self):
@ -34,6 +34,7 @@ class ClubhausEvent(models.Model):
name = models.CharField(max_length=200, blank=True)
date = models.DateTimeField(blank=True, null=True)
active = models.BooleanField(default=False)
voting_locked = models.BooleanField(default=False)
location = models.TextField(blank=True)
beverages = models.TextField(blank=True)
food = models.TextField(blank=True)

View File

@ -131,10 +131,13 @@
{% else %}
<h1>Es hat noch keiner abgestimmt!</h1>
{% endif %}
<button type="button" class="btn btn-primary mt-3 mt-md-1 float-end" data-bs-toggle="modal"
{% if not next_event.voting_locked %}
<button type="button" class="btn btn-primary mt-3 mt-md-1 float-end"
data-bs-toggle="modal"
data-bs-target="#votingModal">
Jetzt abstimmen
</button>
{% endif %}
</div>
</div>
</div>