diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index 1e95ddad..a1025b07 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -121,6 +121,7 @@ INSTALLED_APPS = ( 'seminar', 'galerie', 'korektury', + 'prednasky', # Admin upravy: diff --git a/prednasky/__init__.py b/prednasky/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/prednasky/admin.py b/prednasky/admin.py new file mode 100644 index 00000000..bbcea848 --- /dev/null +++ b/prednasky/admin.py @@ -0,0 +1,7 @@ +from django.contrib import admin + +from models import Prednaska, Seznam, Hlasovani + +admin.site.register(Seznam) +admin.site.register(Prednaska) +admin.site.register(Hlasovani) diff --git a/prednasky/forms.py b/prednasky/forms.py new file mode 100644 index 00000000..969232e3 --- /dev/null +++ b/prednasky/forms.py @@ -0,0 +1,8 @@ +# coding: utf-8 +from django import forms + +class NewPrednaskyForm(forms.Form): + ucastnik = forms.CharField(label = 'Tvoje jméno', max_length = 100) + + + diff --git a/prednasky/migrations/0001_initial.py b/prednasky/migrations/0001_initial.py new file mode 100644 index 00000000..c3510548 --- /dev/null +++ b/prednasky/migrations/0001_initial.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0036_add_org_to_soustredeni'), + ] + + operations = [ + migrations.CreateModel( + name='Hlasovani', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('body', models.IntegerField(default=0, verbose_name=b'Body', choices=[(0, b'0'), (1, b'1'), (-1, b'-1')])), + ('ucastnik', models.CharField(max_length=100, verbose_name=b'\xc3\x9a\xc4\x8dastn\xc3\xadk')), + ], + ), + migrations.CreateModel( + name='Prednaska', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('nazev', models.CharField(max_length=300, verbose_name=b'N\xc3\xa1zev')), + ('anotace', models.TextField(verbose_name=b'Anotace')), + ('obtiznost', models.IntegerField(verbose_name=b'Obt\xc3\xad\xc5\xbenost', choices=[(1, b'Lehk\xc3\xa1'), (2, b'St\xc5\x99edn\xc3\xad'), (3, b'T\xc4\x9b\xc5\xbek\xc3\xa1')])), + ('obor', models.CharField(max_length=5, verbose_name=b'Obor')), + ('klicova', models.CharField(max_length=200, null=True, verbose_name=b'Kl\xc3\xad\xc4\x8dov\xc3\xa1 slova', blank=True)), + ('org', models.ForeignKey(to='seminar.Organizator')), + ], + ), + migrations.CreateModel( + name='Seznam', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ], + ), + migrations.AddField( + model_name='hlasovani', + name='prednaska', + field=models.ForeignKey(to='prednasky.Prednaska'), + ), + ] diff --git a/prednasky/migrations/0002_auto_20160417_2347.py b/prednasky/migrations/0002_auto_20160417_2347.py new file mode 100644 index 00000000..f3527e75 --- /dev/null +++ b/prednasky/migrations/0002_auto_20160417_2347.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('prednasky', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='prednaska', + name='seznam', + field=models.ForeignKey(default=None, blank=True, to='prednasky.Seznam'), + ), + migrations.AlterField( + model_name='hlasovani', + name='body', + field=models.IntegerField(default=0, verbose_name=b'Body', choices=[(-1, b'-1'), (0, b'0'), (1, b'1')]), + ), + ] diff --git a/prednasky/migrations/__init__.py b/prednasky/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/prednasky/models.py b/prednasky/models.py new file mode 100644 index 00000000..0f94f500 --- /dev/null +++ b/prednasky/models.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- + +from django.db import models +from seminar.models import Organizator + +class Seznam(models.Model): + pass + +CHOICES_OBTIZNOST = ( +(1, 'Lehká'), +(2, 'Střední'), +(3, 'Těžká'), +) + +CHOICES_BODY = ( + (-1, '-1'), + (0, '0'), + (1, '1'), + ) + +class Prednaska(models.Model): + nazev = models.CharField('Název', max_length = 300) + org = models.ForeignKey(Organizator) + anotace = models.TextField('Anotace') + obtiznost = models.IntegerField('Obtížnost', choices=CHOICES_OBTIZNOST) + obor = models.CharField('Obor', max_length = 5) + klicova = models.CharField('Klíčová slova', max_length = 200, null = True, blank = True) + seznam = models.ForeignKey(Seznam, blank = True, default = None) + +class Hlasovani(models.Model): + prednaska = models.ForeignKey(Prednaska) + body = models.IntegerField('Body', default = 0, choices = CHOICES_BODY) + ucastnik = models.CharField('Účastník', max_length = 100) + diff --git a/prednasky/templates/prednasky/Base.html b/prednasky/templates/prednasky/Base.html new file mode 100644 index 00000000..6b96372b --- /dev/null +++ b/prednasky/templates/prednasky/Base.html @@ -0,0 +1,40 @@ +{% extends 'base.html' %} + +{% load humanize %} +{% load staticfiles %} + +{% block title %} +Hlasování o přednáškách +{% endblock %} + +{% block content %} + +
+Jak moc by ses chtěl(a) zúčastnit následujících přednášek?
+
+Obtížnost 1 je nejlehčí, 3 nejtěžší.
+