Rozdeleni zadani / reseni u problemu
This commit is contained in:
parent
fad81991ec
commit
a92d3d06b2
5 changed files with 82 additions and 11 deletions
|
@ -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
|
||||
|
||||
|
|
42
seminar/migrations/0016_texty_problemu.py
Normal file
42
seminar/migrations/0016_texty_problemu.py
Normal file
|
@ -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,
|
||||
),
|
||||
]
|
20
seminar/migrations/0017_texty_problemu_minor.py
Normal file
20
seminar/migrations/0017_texty_problemu_minor.py
Normal file
|
@ -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,
|
||||
),
|
||||
]
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
{% block content %}
|
||||
<div>
|
||||
{% if problem.cislo_zadani %}
|
||||
<h2>Problém {{ problem.kod_v_rocniku }} {{ problem.nazev }}</h2>
|
||||
<h2>Problém {{ problem.kod_v_rocniku }}: {{ problem.nazev }}</h2>
|
||||
|
||||
<p>Zadáno v čísle <a href='{{ problem.cislo_zadani.verejne_url }}'>{{ problem.cislo_zadani.kod }}</a>.
|
||||
{% if problem.cislo_reseni %}
|
||||
|
@ -16,14 +16,17 @@
|
|||
{% endif %}
|
||||
|
||||
|
||||
<h3>Text</h3>
|
||||
{{ problem.text_problemu |safe }}
|
||||
<h3>Zadání</h3>
|
||||
{{ problem.text_zadani |safe }}
|
||||
|
||||
<h3>Řešení</h3>
|
||||
{{ problem.text_reseni |safe }}
|
||||
|
||||
{% if True %}
|
||||
<div class='mam-org-only'>
|
||||
|
||||
<h3>Text - org</h3>
|
||||
{{ problem.text_problemu_org |safe }}
|
||||
{{ problem.text_org |safe }}
|
||||
|
||||
<h3>Diskuse - org</h3>
|
||||
{% render_comment_list for object %}
|
||||
|
|
Loading…
Reference in a new issue