diff --git a/seminar/admin.py b/seminar/admin.py index a25df78e..fe24375b 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -226,8 +226,9 @@ from autocomplete_light.contrib.taggit_field import TaggitField, TaggitWidget #TODO: Autocomplete autor/opravovatel class ProblemAdminForm(forms.ModelForm): - text_problemu = forms.CharField(widget=CKEditorWidget()) - text_problemu_org = forms.CharField(widget=CKEditorWidget()) + text_zadani = forms.CharField(widget=CKEditorWidget()) + text_reseni = forms.CharField(widget=CKEditorWidget()) + text_org = forms.CharField(widget=CKEditorWidget()) zamereni = TaggitField(widget=TaggitWidget('TagAutocomplete')) class Meta: model = Problem @@ -237,14 +238,14 @@ class ProblemAdmin(reversion.VersionAdmin): form = ProblemAdminForm fieldsets = [ (None, {'fields': ['nazev', 'typ', 'stav', 'autor', 'zamereni', 'body', 'timestamp', 'import_dakos_id']}), - (u'Vydání', {'fields': ['cislo_zadani', 'kod', 'cislo_reseni', 'opravovatel', 'text_problemu']}), - (None, {'fields': ['text_problemu_org']}), + (u'Vydání', {'fields': ['cislo_zadani', 'kod', 'cislo_reseni', 'opravovatel',]}), + (None, {'fields': ['text_zadani', 'text_reseni', 'text_org',]}), ] readonly_fields = ['timestamp', 'import_dakos_id'] list_display = ['nazev', 'typ', 'kod', 'stav', 'autor', 'opravovatel', 'verejne', 'cislo_zadani', 'pocet_reseni'] list_select_related = True list_filter = ['typ', 'stav', 'timestamp'] - search_fields = ['nazev', 'kod', 'text_problemu_org', 'text_problemu'] + search_fields = ['nazev', 'kod', 'text_zadani', 'text_reseni', 'text_org'] inlines = [ReseniKProblemuInline] view_on_site = Problem.verejne_url diff --git a/seminar/migrations/0016_texty_problemu.py b/seminar/migrations/0016_texty_problemu.py new file mode 100644 index 00000000..451c888e --- /dev/null +++ b/seminar/migrations/0016_texty_problemu.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0015_soustredeni_text'), + ] + + operations = [ + migrations.RenameField( + model_name='problem', + old_name='text_problemu_org', + new_name='text_org', + ), + migrations.RenameField( + model_name='problem', + old_name='text_problemu', + new_name='text_zadani', + ), + migrations.AddField( + model_name='problem', + name='text_reseni', + field=models.TextField(help_text='Ve\u0159ejn\xfd text \u0159e\u0161en\xed (HTML, u t\xe9mat i p\u0159\xedsp\u011bvky a koment\xe1\u0159e)', verbose_name='ve\u0159ejn\xe9 \u0159e\u0161en\xed (HTML)', blank=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='problem', + name='text_org', + field=models.TextField(help_text='Neve\u0159ejn\xfd n\xe1vrh \xfalohy, n\xe1vrh \u0159e\u0161en\xed, text zad\xe1n\xed, pozn\xe1mky ...', verbose_name='org pozn\xe1mky (HTML)', blank=True), + preserve_default=True, + ), + migrations.AlterField( + model_name='problem', + name='text_zadani', + field=models.TextField(help_text='Ve\u0159ejn\xfd text zad\xe1n\xed (HTML)', verbose_name='ve\u0159ejn\xe9 zad\xe1n\xed (HTML)', blank=True), + preserve_default=True, + ), + ] diff --git a/seminar/migrations/0017_texty_problemu_minor.py b/seminar/migrations/0017_texty_problemu_minor.py new file mode 100644 index 00000000..f732c111 --- /dev/null +++ b/seminar/migrations/0017_texty_problemu_minor.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0016_texty_problemu'), + ] + + operations = [ + migrations.AlterField( + model_name='problem', + name='text_reseni', + field=models.TextField(help_text='Ve\u0159ejn\xfd text \u0159e\u0161en\xed (HTML, u t\xe9mat i p\u0159\xedsp\u011bvky a koment\xe1\u0159e)', verbose_name='ve\u0159ejn\xe9 \u0159e\u0161en\xed (HTML)', blank=True), + preserve_default=True, + ), + ] diff --git a/seminar/models.py b/seminar/models.py index 4c48c8b4..9050b109 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -348,9 +348,14 @@ class Problem(SeminarModelBase): zamereni = TaggableManager(verbose_name=u'zaměření', help_text='Zaměření M/F/I/O problému, příp. další tagy', blank=True) - text_problemu_org = models.TextField(u'neveřejné zadání a organizátorské a poznámky', blank=True) + text_org = models.TextField(u'org poznámky (HTML)', blank=True, + help_text=u'Neveřejný návrh úlohy, návrh řešení, text zadání, poznámky ...') - text_problemu = models.TextField(u'veřejný text zadání a řešení', blank=True) + text_zadani = models.TextField(u'veřejné zadání (HTML)', blank=True, + help_text=u'Veřejný text zadání (HTML)') + + text_reseni = models.TextField(u'veřejné řešení (HTML)', blank=True, + help_text=u'Veřejný text řešení (HTML, u témat i příspěvky a komentáře)') autor = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=u'autor problému', related_name='autor_uloh', null=True, blank=True) diff --git a/seminar/templates/seminar/problem.html b/seminar/templates/seminar/problem.html index f7778281..bcec4b93 100644 --- a/seminar/templates/seminar/problem.html +++ b/seminar/templates/seminar/problem.html @@ -5,7 +5,7 @@ {% block content %}
{% if problem.cislo_zadani %} -

Problém {{ problem.kod_v_rocniku }} {{ problem.nazev }}

+

Problém {{ problem.kod_v_rocniku }}: {{ problem.nazev }}

Zadáno v čísle {{ problem.cislo_zadani.kod }}. {% if problem.cislo_reseni %} @@ -16,14 +16,17 @@ {% endif %} -

Text

- {{ problem.text_problemu |safe }} +

Zadání

+ {{ problem.text_zadani |safe }} + +

Řešení

+ {{ problem.text_reseni |safe }} {% if True %}

Text - org

- {{ problem.text_problemu_org |safe }} + {{ problem.text_org |safe }}

Diskuse - org

{% render_comment_list for object %}