Merge remote-tracking branch 'origin/master' into Petr
This commit is contained in:
commit
036a7f9593
14 changed files with 255 additions and 26 deletions
6
Makefile
6
Makefile
|
@ -85,6 +85,8 @@ push_test:
|
||||||
./manage.py migrate --noinput && \
|
./manage.py migrate --noinput && \
|
||||||
(chown -Rf :mam . || true ) && \
|
(chown -Rf :mam . || true ) && \
|
||||||
(chmod -Rf g+w . || true ) && \
|
(chmod -Rf g+w . || true ) && \
|
||||||
|
echo 'Reloading apache ... (You may have to start it manually on error!)' && \
|
||||||
|
~/etc/apache2/apache2ctl -k reload && \
|
||||||
echo Done."
|
echo Done."
|
||||||
@echo "Test pushed to ${TEST_SERVER}:${TEST_DIR} successfully."
|
@echo "Test pushed to ${TEST_SERVER}:${TEST_DIR} successfully."
|
||||||
|
|
||||||
|
@ -93,6 +95,8 @@ push_prod:
|
||||||
git tag deploy-prod-`date +%Y-%m-%d-%H-%M`-${USER}
|
git tag deploy-prod-`date +%Y-%m-%d-%H-%M`-${USER}
|
||||||
git push --all
|
git push --all
|
||||||
ssh ${PROD_USER}@${PROD_SERVER} -n -x "\
|
ssh ${PROD_USER}@${PROD_SERVER} -n -x "\
|
||||||
|
echo 'Stopping apache ... (You may have to start it manually on error!)' && \
|
||||||
|
~/etc/apache2/apache2ctl -k stop && \
|
||||||
cd ${PROD_DIR} && \
|
cd ${PROD_DIR} && \
|
||||||
./backup_prod_db.sh && \
|
./backup_prod_db.sh && \
|
||||||
git fetch --all && \
|
git fetch --all && \
|
||||||
|
@ -104,6 +108,8 @@ push_prod:
|
||||||
./manage.py migrate --noinput && \
|
./manage.py migrate --noinput && \
|
||||||
(chown -Rf :mam . || true ) && \
|
(chown -Rf :mam . || true ) && \
|
||||||
(chmod -Rf g+w . || true ) && \
|
(chmod -Rf g+w . || true ) && \
|
||||||
|
echo 'Starting apache ... (You may have to start it manually on error!)' && \
|
||||||
|
~/etc/apache2/apache2ctl -k start && \
|
||||||
echo Done."
|
echo Done."
|
||||||
@echo "Deployed to ${PROD_SERVER}:${PROD_DIR} successfully."
|
@echo "Deployed to ${PROD_SERVER}:${PROD_DIR} successfully."
|
||||||
|
|
||||||
|
|
24
mamweb/admin.py
Normal file
24
mamweb/admin.py
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.contrib.flatpages.models import FlatPage
|
||||||
|
|
||||||
|
# Note: we are renaming the original Admin and Form as we import them!
|
||||||
|
from django.contrib.flatpages.admin import FlatPageAdmin as FlatPageAdminOld
|
||||||
|
from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld
|
||||||
|
|
||||||
|
from django import forms
|
||||||
|
from ckeditor.widgets import CKEditorWidget
|
||||||
|
|
||||||
|
class FlatpageForm(FlatpageFormOld):
|
||||||
|
content = forms.CharField(widget=CKEditorWidget())
|
||||||
|
class Meta:
|
||||||
|
model = FlatPage # this is not automatically inherited from FlatpageFormOld
|
||||||
|
exclude = []
|
||||||
|
|
||||||
|
|
||||||
|
class FlatPageAdmin(FlatPageAdminOld):
|
||||||
|
form = FlatpageForm
|
||||||
|
|
||||||
|
|
||||||
|
# We have to unregister the normal admin, and then reregister ours
|
||||||
|
admin.site.unregister(FlatPage)
|
||||||
|
admin.site.register(FlatPage, FlatPageAdmin)
|
|
@ -64,6 +64,7 @@ MIDDLEWARE_CLASSES = (
|
||||||
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
|
||||||
)
|
)
|
||||||
|
|
||||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||||
|
@ -104,6 +105,8 @@ INSTALLED_APPS = (
|
||||||
'threadedcomments',
|
'threadedcomments',
|
||||||
'django_comments',
|
'django_comments',
|
||||||
|
|
||||||
|
'django.contrib.flatpages',
|
||||||
|
|
||||||
# MaMweb
|
# MaMweb
|
||||||
'mamweb',
|
'mamweb',
|
||||||
'seminar',
|
'seminar',
|
||||||
|
@ -117,7 +120,6 @@ INSTALLED_APPS = (
|
||||||
# 'admin_tools.menu',
|
# 'admin_tools.menu',
|
||||||
# 'admin_tools.dashboard',
|
# 'admin_tools.dashboard',
|
||||||
'flat',
|
'flat',
|
||||||
|
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,12 @@
|
||||||
<!-- TODO: only on org login -->
|
<!-- TODO: only on org login -->
|
||||||
<div class="login-bar" style='background: #F80;'>
|
<div class="login-bar" style='background: #F80;'>
|
||||||
{% if view.object %}
|
{% if view.object %}
|
||||||
Objekt {{ view.object }}: {{ view.object }}
|
Objekt {{ view.object }}: {{ view.object }}
|
||||||
{% if view.object.admin_url %}<a href='{{ view.object.admin_url }}'>[admin]</a>{% endif %}
|
{% if view.object.admin_url %}<a href='{{ view.object.admin_url }}'>[admin]</a>{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if flatpage %}
|
||||||
|
Stránka <tt>{{ flatpage.url }}</tt> ({{ flatpage.title }})
|
||||||
|
<a href='{% url 'admin:flatpages_flatpage_change' flatpage.id %}'>[admin]</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
11
mamweb/templates/flatpages/default.html
Normal file
11
mamweb/templates/flatpages/default.html
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}{{ flatpage.title }}{% endblock title %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h2>{{ flatpage.title }}</h2>
|
||||||
|
<div>
|
||||||
|
{{ flatpage.content }}
|
||||||
|
</div>
|
||||||
|
{% endblock content %}
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}{{ flatpage.title }}{% endblock title %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div>
|
<div>Toto je stránka podle šablony "home.html"</div>
|
||||||
<h2>Vítejte na testwebu MaM!</h2>
|
|
||||||
<p><a href='{% url 'admin:index' %}'>Administrátorské rozhraní</a> (admin/admin)
|
<p><a href='{% url 'admin:index' %}'>Administrátorské rozhraní</a> (admin/admin)
|
||||||
|
<h2>{{ flatpage.title }}</h2>
|
||||||
|
<div>
|
||||||
|
{{ flatpage.content }}
|
||||||
</div>
|
</div>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,8 @@ urlpatterns = i18n_patterns('',
|
||||||
url(r'^comments_dj/', include('django_comments.urls')),
|
url(r'^comments_dj/', include('django_comments.urls')),
|
||||||
url(r'^comments_fl/', include('fluent_comments.urls')),
|
url(r'^comments_fl/', include('fluent_comments.urls')),
|
||||||
|
|
||||||
# Obsah
|
# Obsah - flatpages
|
||||||
url(r'^$', TemplateView.as_view(template_name='home.html'), name='home'),
|
url(r'^', include('django.contrib.flatpages.urls')), # Pozor: musi byt posledni
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# This is only needed when using runserver.
|
# This is only needed when using runserver.
|
||||||
|
|
|
@ -17,6 +17,25 @@ import autocomplete_light
|
||||||
admin.site.register(Nastaveni, SingletonModelAdmin)
|
admin.site.register(Nastaveni, SingletonModelAdmin)
|
||||||
|
|
||||||
|
|
||||||
|
### UTILS (pro verbose_name a help_text)
|
||||||
|
|
||||||
|
def field_labels(model, fieldname):
|
||||||
|
f = [i for i in model._meta.fields if i.name == fieldname][0]
|
||||||
|
return {'label': f.verbose_name.capitalize(), 'help_text': f.help_text, }
|
||||||
|
|
||||||
|
def create_modeladmin(modeladmin, model, name = None, verbose_name = None, verbose_name_plural = None):
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
proxy = True
|
||||||
|
app_label = model._meta.app_label
|
||||||
|
Meta.verbose_name = verbose_name
|
||||||
|
Meta.verbose_name_plural = verbose_name_plural
|
||||||
|
|
||||||
|
attrs = {'__module__': '', 'Meta': Meta}
|
||||||
|
newmodel = type(name, (model,), attrs)
|
||||||
|
admin.site.register(newmodel, modeladmin)
|
||||||
|
return modeladmin
|
||||||
|
|
||||||
### INLINES
|
### INLINES
|
||||||
|
|
||||||
class ResitelInline(admin.TabularInline):
|
class ResitelInline(admin.TabularInline):
|
||||||
|
@ -224,10 +243,12 @@ admin.site.register(Reseni, ReseniAdmin)
|
||||||
from autocomplete_light.contrib.taggit_field import TaggitField, TaggitWidget
|
from autocomplete_light.contrib.taggit_field import TaggitField, TaggitWidget
|
||||||
|
|
||||||
#TODO: Autocomplete autor/opravovatel
|
#TODO: Autocomplete autor/opravovatel
|
||||||
|
|
||||||
class ProblemAdminForm(forms.ModelForm):
|
class ProblemAdminForm(forms.ModelForm):
|
||||||
text_problemu = forms.CharField(widget=CKEditorWidget())
|
text_zadani = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Problem, 'text_zadani'))
|
||||||
text_problemu_org = forms.CharField(widget=CKEditorWidget())
|
text_reseni = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Problem, 'text_reseni'))
|
||||||
zamereni = TaggitField(widget=TaggitWidget('TagAutocomplete'))
|
text_org = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Problem, 'text_org'))
|
||||||
|
zamereni = TaggitField(widget=TaggitWidget('TagAutocomplete'), required=False)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Problem
|
model = Problem
|
||||||
exclude = []
|
exclude = []
|
||||||
|
@ -236,32 +257,56 @@ class ProblemAdmin(reversion.VersionAdmin):
|
||||||
form = ProblemAdminForm
|
form = ProblemAdminForm
|
||||||
fieldsets = [
|
fieldsets = [
|
||||||
(None, {'fields': ['nazev', 'typ', 'stav', 'autor', 'zamereni', 'body', 'timestamp', 'import_dakos_id']}),
|
(None, {'fields': ['nazev', 'typ', 'stav', 'autor', 'zamereni', 'body', 'timestamp', 'import_dakos_id']}),
|
||||||
(u'Vydání', {'fields': ['cislo_zadani', 'kod', 'cislo_reseni', 'opravovatel', 'text_problemu']}),
|
(u'Vydání', {'fields': ['cislo_zadani', 'kod', 'cislo_reseni', 'opravovatel',]}),
|
||||||
(None, {'fields': ['text_problemu_org']}),
|
(None, {'fields': ['text_zadani', 'text_reseni', 'text_org',]}),
|
||||||
]
|
]
|
||||||
readonly_fields = ['timestamp', 'import_dakos_id']
|
readonly_fields = ['timestamp', 'import_dakos_id']
|
||||||
list_display = ['nazev', 'typ', 'kod', 'stav', 'autor', 'opravovatel', 'verejne', 'cislo_zadani', 'pocet_reseni']
|
|
||||||
list_select_related = True
|
list_select_related = True
|
||||||
list_filter = ['typ', 'stav', 'timestamp']
|
search_fields = ['nazev', 'text_zadani', 'text_reseni', 'text_org']
|
||||||
search_fields = ['nazev', 'kod', 'text_problemu_org', 'text_problemu']
|
|
||||||
inlines = [ReseniKProblemuInline]
|
|
||||||
view_on_site = Problem.verejne_url
|
view_on_site = Problem.verejne_url
|
||||||
|
|
||||||
def get_queryset(self, request):
|
def get_queryset(self, request):
|
||||||
qs = super(ProblemAdmin, self).get_queryset(request)
|
qs = super(ProblemAdmin, self).get_queryset(request)
|
||||||
return qs.select_related('autor', 'opravovatel', 'cislo_zadani', 'cislo_reseni').annotate(pocet_reseni=Count('reseni'))
|
return qs.select_related('autor', 'opravovatel', 'cislo_zadani', 'cislo_reseni')
|
||||||
|
|
||||||
def pocet_reseni(self, obj):
|
def pocet_reseni(self, obj):
|
||||||
return obj.pocet_reseni
|
return obj.pocet_reseni
|
||||||
|
|
||||||
admin.site.register(Problem, ProblemAdmin)
|
class ProblemNavrhAdmin(ProblemAdmin):
|
||||||
|
list_display = ['nazev', 'typ', 'stav', 'autor', 'timestamp']
|
||||||
|
list_filter = ['typ', 'stav', 'timestamp']
|
||||||
|
|
||||||
|
def get_queryset(self, request):
|
||||||
|
qs = super(ProblemNavrhAdmin, self).get_queryset(request)
|
||||||
|
return qs.filter(stav__in=[Problem.STAV_NAVRH, Problem.STAV_SMAZANY])
|
||||||
|
|
||||||
|
create_modeladmin(ProblemNavrhAdmin, Problem, 'ProblemNavrh', verbose_name=u'Problém (návrh)', verbose_name_plural=u'Problémy (návrhy)')
|
||||||
|
|
||||||
|
class ProblemZadanyAdmin(ProblemAdmin):
|
||||||
|
list_display = ['nazev', 'typ', 'autor', 'opravovatel', 'kod', 'cislo_zadani', 'pocet_reseni', 'verejne']
|
||||||
|
list_filter = ['typ', 'cislo_zadani__rocnik']
|
||||||
|
inlines = [ReseniKProblemuInline]
|
||||||
|
|
||||||
|
def get_queryset(self, request):
|
||||||
|
qs = super(ProblemZadanyAdmin, self).get_queryset(request)
|
||||||
|
return qs.filter(stav=Problem.STAV_ZADANY).annotate(pocet_reseni=Count('reseni'))
|
||||||
|
|
||||||
|
create_modeladmin(ProblemZadanyAdmin, Problem, 'ProblemZadany', verbose_name=u'Problém (zadaný)', verbose_name_plural=u'Problémy (zadané)')
|
||||||
|
|
||||||
|
#admin.site.register(Problem, ProblemAdmin)
|
||||||
|
|
||||||
### Soustredeni
|
### Soustredeni
|
||||||
|
|
||||||
|
class SoustredeniAdminForm(forms.ModelForm):
|
||||||
|
text = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Soustredeni, 'text'))
|
||||||
|
class Meta:
|
||||||
|
model = Soustredeni
|
||||||
|
exclude = []
|
||||||
|
|
||||||
class SoustredeniAdmin(reversion.VersionAdmin):
|
class SoustredeniAdmin(reversion.VersionAdmin):
|
||||||
|
form = SoustredeniAdminForm
|
||||||
fieldsets = [
|
fieldsets = [
|
||||||
(None, {'fields': ['rocnik', 'misto', 'verejne_db']}),
|
(None, {'fields': ['rocnik', 'misto', 'verejne_db', 'text']}),
|
||||||
(u'Data', {'fields': ['datum_zacatku', 'datum_konce']}),
|
(u'Data', {'fields': ['datum_zacatku', 'datum_konce']}),
|
||||||
]
|
]
|
||||||
list_display = ['rocnik', 'misto', 'datum_zacatku', 'verejne']
|
list_display = ['rocnik', 'misto', 'datum_zacatku', 'verejne']
|
||||||
|
|
20
seminar/migrations/0015_soustredeni_text.py
Normal file
20
seminar/migrations/0015_soustredeni_text.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', '0014_uprava_poznamek'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='soustredeni',
|
||||||
|
name='text',
|
||||||
|
field=models.TextField(default=b'', verbose_name='text k soust\u0159ed\u011bn\xed (HTML)', blank=True),
|
||||||
|
preserve_default=True,
|
||||||
|
),
|
||||||
|
]
|
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,
|
||||||
|
),
|
||||||
|
]
|
36
seminar/migrations/0018_problemnavrh_problemzadany.py
Normal file
36
seminar/migrations/0018_problemnavrh_problemzadany.py
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import models, migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('seminar', '0017_texty_problemu_minor'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='ProblemNavrh',
|
||||||
|
fields=[
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name': 'Probl\xe9m (n\xe1vrh)',
|
||||||
|
'proxy': True,
|
||||||
|
'verbose_name_plural': 'Probl\xe9my (n\xe1vrhy)',
|
||||||
|
},
|
||||||
|
bases=('seminar.problem',),
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='ProblemZadany',
|
||||||
|
fields=[
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name': 'Probl\xe9m (zadan\xfd)',
|
||||||
|
'proxy': True,
|
||||||
|
'verbose_name_plural': 'Probl\xe9my (zadan\xe9)',
|
||||||
|
},
|
||||||
|
bases=('seminar.problem',),
|
||||||
|
),
|
||||||
|
]
|
|
@ -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)
|
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)
|
autor = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=u'autor problému', related_name='autor_uloh', null=True, blank=True)
|
||||||
|
|
||||||
|
@ -391,6 +396,12 @@ class Problem(SeminarModelBase):
|
||||||
def verejne_url(self):
|
def verejne_url(self):
|
||||||
return reverse('seminar_problem', kwargs={'pk': self.id})
|
return reverse('seminar_problem', kwargs={'pk': self.id})
|
||||||
|
|
||||||
|
def admin_url(self):
|
||||||
|
if self.stav == Problem.STAV_ZADANY:
|
||||||
|
return reverse('admin:seminar_problemzadany_change', args=(self.id, ))
|
||||||
|
else:
|
||||||
|
return reverse('admin:seminar_problemnavrh_change', args=(self.id, ))
|
||||||
|
|
||||||
|
|
||||||
@reversion.register(ignore_duplicate_revisions=True)
|
@reversion.register(ignore_duplicate_revisions=True)
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
|
@ -498,6 +509,8 @@ class Soustredeni(SeminarModelBase):
|
||||||
ucastnici = models.ManyToManyField(Resitel, verbose_name=u'účastníci soustředění',
|
ucastnici = models.ManyToManyField(Resitel, verbose_name=u'účastníci soustředění',
|
||||||
help_text=u'Seznam účastníků soustředění', through='Soustredeni_Ucastnici')
|
help_text=u'Seznam účastníků soustředění', through='Soustredeni_Ucastnici')
|
||||||
|
|
||||||
|
text = models.TextField(u'text k soustředění (HTML)', blank=True, default='')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return force_unicode(u'%s (%s)' % (self.misto, self.datum_zacatku))
|
return force_unicode(u'%s (%s)' % (self.misto, self.datum_zacatku))
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div>
|
<div>
|
||||||
{% if problem.cislo_zadani %}
|
{% 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>.
|
<p>Zadáno v čísle <a href='{{ problem.cislo_zadani.verejne_url }}'>{{ problem.cislo_zadani.kod }}</a>.
|
||||||
{% if problem.cislo_reseni %}
|
{% if problem.cislo_reseni %}
|
||||||
|
@ -16,14 +16,17 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<h3>Text</h3>
|
<h3>Zadání</h3>
|
||||||
{{ problem.text_problemu |safe }}
|
{{ problem.text_zadani |safe }}
|
||||||
|
|
||||||
|
<h3>Řešení</h3>
|
||||||
|
{{ problem.text_reseni |safe }}
|
||||||
|
|
||||||
{% if True %}
|
{% if True %}
|
||||||
<div class='mam-org-only'>
|
<div class='mam-org-only'>
|
||||||
|
|
||||||
<h3>Text - org</h3>
|
<h3>Text - org</h3>
|
||||||
{{ problem.text_problemu_org |safe }}
|
{{ problem.text_org |safe }}
|
||||||
|
|
||||||
<h3>Diskuse - org</h3>
|
<h3>Diskuse - org</h3>
|
||||||
{% render_comment_list for object %}
|
{% render_comment_list for object %}
|
||||||
|
|
Loading…
Reference in a new issue