Seznamy šifer: migrace + fix
This commit is contained in:
parent
56944d164f
commit
75fba8003d
2 changed files with 22 additions and 1 deletions
sifrovacka
21
sifrovacka/migrations/0008_seznamsifer.py
Normal file
21
sifrovacka/migrations/0008_seznamsifer.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Generated by Django 4.2.20 on 2025-03-19 21:39
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('sifrovacka', '0007_alter_napoveda_sifra_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='SeznamSifer',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('jmeno', models.CharField(help_text='něco co jde zadat do adresy', max_length=255, verbose_name='Jméno seznamu')),
|
||||
('sifry', models.ManyToManyField(to='sifrovacka.spravnaodpoved')),
|
||||
],
|
||||
),
|
||||
]
|
|
@ -35,7 +35,7 @@ class SifrovackaNektereListView(SifrovackaListView):
|
|||
def get_queryset(self):
|
||||
seznam = get_object_or_404(SeznamSifer, jmeno=self.kwargs['seznam'])
|
||||
orig = super().get_queryset()
|
||||
return orig.filter(sifra__in=seznam.sifry.all())
|
||||
return orig.filter(sifra__in=seznam.sifry.all().values('sifra')) # poslední je kvůli tomu, že máme odkaz na celý objekt a ne jen na jméno šifry.
|
||||
|
||||
|
||||
class NapovedaView(FormView):
|
||||
|
|
Loading…
Reference in a new issue