Browse Source

seminar | Pridan OtisknuteReseniNode, zakomentovany stare views.

export_seznamu_prednasek
parent
commit
7cfb2c414e
  1. 27
      seminar/migrations/0078_otistenereseninode.py
  2. 20
      seminar/models.py
  3. 8
      seminar/urls.py

27
seminar/migrations/0078_otistenereseninode.py

@ -0,0 +1,27 @@
# Generated by Django 2.2.9 on 2020-03-18 23:59
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('seminar', '0077_auto_20200318_2146'),
]
operations = [
migrations.CreateModel(
name='OtisteneReseniNode',
fields=[
('treenode_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='seminar.TreeNode')),
('reseni', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='seminar.Reseni', verbose_name='reseni')),
],
options={
'verbose_name': 'Otištěné řešení (Node)',
'verbose_name_plural': 'Otištěná řešení (Node)',
'db_table': 'seminar_nodes_otistene_reseni',
},
bases=('seminar.treenode',),
),
]

20
seminar/models.py

@ -1474,6 +1474,26 @@ class CastNode(TreeNode):
nadpis = models.CharField('Nadpis', max_length=100, help_text = 'Nadpis podvěšené části obsahu')
def aktualizuj_nazev(self):
self.nazev = "CastNode: "+str(self.nadpis)
def getOdkazStr(self):
return str(self.nadpis)
class OtisteneReseniNode(TreeNode):
class Meta:
db_table = 'seminar_nodes_otistene_reseni'
verbose_name = 'Otištěné řešení (Node)'
verbose_name_plural = 'Otištěná řešení (Node)'
reseni = models.ForeignKey(Reseni,
on_delete=models.PROTECT,
verbose_name = 'reseni')
def aktualizuj_nazev(self):
self.nazev = "OtisteneReseniNode: "+str(self.reseni)
def getOdkazStr(self):
return str(self.reseni)
## FIXME: Logiku přesunout do views.
#class VysledkyBase(SeminarModelBase):

8
seminar/urls.py

@ -8,8 +8,8 @@ from django.contrib.auth import views as auth_views
staff_member_required = user_passes_test(lambda u: u.is_staff)
urlpatterns = [
path('aktualni/temata/', views.TemataRozcestnikView),
path('<int:rocnik>/t<int:tematko>/', views.TematkoView),
# path('aktualni/temata/', views.TemataRozcestnikView),
# path('<int:rocnik>/t<int:tematko>/', views.TematkoView),
# REDIRECTy
path('jak-resit/', RedirectView.as_view(url='/co-je-MaM/jak-resit/')),
@ -60,8 +60,8 @@ urlpatterns = [
),
# Zadani
path('zadani/aktualni/', views.AktualniZadaniView, name='seminar_aktualni_zadani'),
path('zadani/temata/', views.ZadaniTemataView, name='seminar_temata'),
# path('zadani/aktualni/', views.AktualniZadaniView, name='seminar_aktualni_zadani'),
# path('zadani/temata/', views.ZadaniTemataView, name='seminar_temata'),
#path('zadani/vysledkova-listina/', views.ZadaniAktualniVysledkovkaView, name='seminar_vysledky'),
path('stare-novinky/', views.StareNovinkyView.as_view(), name='stare_novinky'),

Loading…
Cancel
Save