Nápovědy v šifrovačce #46
Merged
zelvuska
merged 1 commits from sifrovackav2
into master
7 months ago
9 changed files with 206 additions and 6 deletions
@ -1,8 +1,10 @@ |
|||||
from django.contrib import admin |
from django.contrib import admin |
||||
|
|
||||
from .models import OdpovedUcastnika, SpravnaOdpoved |
from .models import OdpovedUcastnika, SpravnaOdpoved, NapovezenoUcastnikovi, Napoveda |
||||
|
|
||||
# Register your models here. |
# Register your models here. |
||||
|
|
||||
admin.site.register(OdpovedUcastnika) |
admin.site.register(OdpovedUcastnika) |
||||
admin.site.register(SpravnaOdpoved) |
admin.site.register(SpravnaOdpoved) |
||||
|
admin.site.register(Napoveda) |
||||
|
admin.site.register(NapovezenoUcastnikovi) |
||||
|
@ -0,0 +1,65 @@ |
|||||
|
# Generated by Django 4.2.8 on 2024-04-14 12:57 |
||||
|
|
||||
|
from django.db import migrations, models |
||||
|
import django.db.models.deletion |
||||
|
import django.utils.timezone |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
dependencies = [ |
||||
|
( |
||||
|
"seminar", |
||||
|
"0114_related_name_se_zmenilo_a_django_chce_migraci_tak_dostane_migraci", |
||||
|
), |
||||
|
("sifrovacka", "0003_odpoveducastnika_uspech"), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.CreateModel( |
||||
|
name="Napoveda", |
||||
|
fields=[ |
||||
|
( |
||||
|
"id", |
||||
|
models.AutoField( |
||||
|
auto_created=True, |
||||
|
primary_key=True, |
||||
|
serialize=False, |
||||
|
verbose_name="ID", |
||||
|
), |
||||
|
), |
||||
|
("text", models.TextField()), |
||||
|
("sifra", models.IntegerField()), |
||||
|
], |
||||
|
), |
||||
|
migrations.CreateModel( |
||||
|
name="NapovezenoUcastnikovi", |
||||
|
fields=[ |
||||
|
( |
||||
|
"id", |
||||
|
models.AutoField( |
||||
|
auto_created=True, |
||||
|
primary_key=True, |
||||
|
serialize=False, |
||||
|
verbose_name="ID", |
||||
|
), |
||||
|
), |
||||
|
("sifra", models.IntegerField(verbose_name="Číslo šifry")), |
||||
|
( |
||||
|
"timestamp", |
||||
|
models.DateTimeField( |
||||
|
default=django.utils.timezone.now, verbose_name="Timestamp" |
||||
|
), |
||||
|
), |
||||
|
( |
||||
|
"resitel", |
||||
|
models.ForeignKey( |
||||
|
on_delete=django.db.models.deletion.CASCADE, |
||||
|
to="seminar.resitel", |
||||
|
), |
||||
|
), |
||||
|
], |
||||
|
options={ |
||||
|
"ordering": ["-timestamp"], |
||||
|
}, |
||||
|
), |
||||
|
] |
@ -0,0 +1,48 @@ |
|||||
|
{% extends "base.html" %} |
||||
|
|
||||
|
{% block content %} |
||||
|
|
||||
|
<br> |
||||
|
|
||||
|
<h1>{% block nadpis1a %}M&Mí šifrovačka{% endblock nadpis1a %}</h1> |
||||
|
|
||||
|
<br> |
||||
|
|
||||
|
<h2>Získat nápovědu k šifře:</h2> |
||||
|
|
||||
|
<form action="{% url 'sifrovacka_napoveda' %}" method="post"> |
||||
|
<table class="form"> |
||||
|
{{form.non_field_errors}} |
||||
|
{% for field in form %} |
||||
|
<tr> |
||||
|
<td> |
||||
|
<label class="field-label{% if field.field.required %} field-required{% endif %}" for="{{ field.id_for_label }}"> |
||||
|
{{ field.label }} |
||||
|
</label> |
||||
|
|
||||
|
</td> |
||||
|
|
||||
|
<td {% if field.help_text %} class="field-with-comment"{% endif %}> |
||||
|
{{ field }} |
||||
|
<span class="field-comment">{{ field.help_text|safe }}</span> |
||||
|
</td> |
||||
|
|
||||
|
</tr> |
||||
|
|
||||
|
|
||||
|
{% if field.errors %} |
||||
|
<tr> |
||||
|
<td colspan="2"><span class="field-error">{{ field.errors }}</span></td> |
||||
|
</tr> |
||||
|
{% endif %} |
||||
|
{% endfor %} |
||||
|
</table> |
||||
|
|
||||
|
{% csrf_token %} |
||||
|
|
||||
|
<input type="submit" value="Chci nápovědu"> |
||||
|
</form> |
||||
|
|
||||
|
<a href="{% url 'sifrovacka' %}">Nechceme nápovědu, známe řešení!</a> |
||||
|
|
||||
|
{% endblock content %} |
@ -0,0 +1,23 @@ |
|||||
|
{% extends "base.html" %} |
||||
|
|
||||
|
{% block content %} |
||||
|
|
||||
|
<h1>{% block nadpis1a %}Šifrovačka vzaté nápovědy{% endblock nadpis1a %}</h1> |
||||
|
|
||||
|
<table class="dosla_reseni"> |
||||
|
<tr> |
||||
|
<th>Timestamp</th> |
||||
|
<th>Řešitel</th> |
||||
|
<th>Šifra</th> |
||||
|
</tr> |
||||
|
|
||||
|
{% for u in object_list %} |
||||
|
<tr> |
||||
|
<td>{{ u.timestamp }}</td> |
||||
|
<td>{{ u.resitel }}</td> |
||||
|
<td>{{ u.sifra }}</td> |
||||
|
</tr> |
||||
|
{% endfor %} |
||||
|
</table> |
||||
|
|
||||
|
{% endblock content %} |
Loading…
Reference in new issue