(sifrovacka) odlišení přijmutých a nepřijmutých odpovědí
This commit is contained in:
parent
10c6f4be16
commit
e589564840
4 changed files with 23 additions and 1 deletions
18
sifrovacka/migrations/0003_odpoveducastnika_uspech.py
Normal file
18
sifrovacka/migrations/0003_odpoveducastnika_uspech.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.2.22 on 2023-10-16 17:51
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('sifrovacka', '0002_auto_20231015_1944'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='odpoveducastnika',
|
||||
name='uspech',
|
||||
field=models.BooleanField(default=False, verbose_name='Úspěch'),
|
||||
),
|
||||
]
|
|
@ -15,6 +15,7 @@ class OdpovedUcastnika(models.Model):
|
|||
odpoved = models.TextField("Tajenka bez diakritiky", blank=False, null=False,)
|
||||
sifra = models.IntegerField("Číslo šifry", blank=False, null=False,)
|
||||
timestamp = models.DateTimeField("Timestamp", blank=False, null=False, default=timezone.now)
|
||||
uspech = models.BooleanField("Úspěch", blank=False, null=False, default=False)
|
||||
|
||||
|
||||
class SpravnaOdpoved(models.Model):
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<td>{{ u.timestamp }}</td>
|
||||
<td>{{ u.resitel }}</td>
|
||||
<td>{{ u.sifra }}</td>
|
||||
<td>{{ u.odpoved }}</td>
|
||||
<td style="color: {% if u.uspech %}green{% else %}red{% endif %};">{{ u.odpoved }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
|
|
@ -22,6 +22,9 @@ class SifrovackaView(FormView):
|
|||
if sifra is None:
|
||||
return formularOKView(self.request, f'<h1>Bohužel vám hvězdy nebyly nakloněny. Rozumějte <i>máte to blbě</i>.</h1> <p><a href="{reverse("sifrovacka")}">Zkusit znovu.</a></p><br><br><br>')
|
||||
|
||||
instance.uspech = True
|
||||
instance.save()
|
||||
|
||||
return formularOKView(self.request, f'<h1>{sifra.skryty_text}</h1> <p><a href="{reverse("sifrovacka")}">Odevzdat další.</a></p><br><br><br>')
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue