Browse Source

Odpovědi od účastníků mají nově i timestamp

pull/40/head
Jonas Havelka 1 year ago
parent
commit
1f7b770a5c
  1. 28
      sifrovacka/migrations/0002_auto_20231015_1944.py
  2. 7
      sifrovacka/models.py
  3. 2
      sifrovacka/templates/sifrovacka/odpovedi_list.html

28
sifrovacka/migrations/0002_auto_20231015_1944.py

@ -0,0 +1,28 @@
# Generated by Django 3.2.22 on 2023-10-15 17:44
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('sifrovacka', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='odpoveducastnika',
options={'ordering': ['-timestamp']},
),
migrations.AddField(
model_name='odpoveducastnika',
name='timestamp',
field=models.DateTimeField(default=django.utils.timezone.now, verbose_name='Timestamp'),
),
migrations.AlterField(
model_name='odpoveducastnika',
name='odpoved',
field=models.TextField(verbose_name='Tajenka bez diakritiky'),
),
]

7
sifrovacka/models.py

@ -1,4 +1,5 @@
from django.db import models from django.db import models
from django.utils import timezone
from seminar.models.personalni import Resitel from seminar.models.personalni import Resitel
@ -7,9 +8,13 @@ from seminar.models.personalni import Resitel
class OdpovedUcastnika(models.Model): class OdpovedUcastnika(models.Model):
class Meta:
ordering = ["-timestamp"]
resitel = models.ForeignKey(Resitel, blank=False, null=False, on_delete=models.CASCADE) resitel = models.ForeignKey(Resitel, blank=False, null=False, on_delete=models.CASCADE)
odpoved = models.TextField("Tajenka", blank=False, null=False,) odpoved = models.TextField("Tajenka bez diakritiky", blank=False, null=False,)
sifra = models.IntegerField("Číslo šifry", blank=False, null=False,) sifra = models.IntegerField("Číslo šifry", blank=False, null=False,)
timestamp = models.DateTimeField("Timestamp", blank=False, null=False, default=timezone.now)
class SpravnaOdpoved(models.Model): class SpravnaOdpoved(models.Model):

2
sifrovacka/templates/sifrovacka/odpovedi_list.html

@ -6,6 +6,7 @@
<table class="dosla_reseni"> <table class="dosla_reseni">
<tr> <tr>
<th>Timestamp</th>
<th>Řešitel</th> <th>Řešitel</th>
<th>Šifra</th> <th>Šifra</th>
<th>Odpověď</th> <th>Odpověď</th>
@ -13,6 +14,7 @@
{% for u in object_list %} {% for u in object_list %}
<tr> <tr>
<td>{{ u.timestamp }}</td>
<td>{{ u.resitel }}</td> <td>{{ u.resitel }}</td>
<td>{{ u.sifra }}</td> <td>{{ u.sifra }}</td>
<td>{{ u.odpoved }}</td> <td>{{ u.odpoved }}</td>

Loading…
Cancel
Save