Merge branch 'master' of atrey.karlin.mff.cuni.cz:/akce/MaM/MaMweb/mamweb
Opravila jsem konflikty - hlavně u komentářů ke kódu, které jsem přidala sama a zároveň i Gavento. Conflicts: seminar/views.py
This commit is contained in:
commit
165b6cb25f
11 changed files with 233 additions and 24 deletions
2
Makefile
2
Makefile
|
@ -86,7 +86,7 @@ push_test:
|
|||
(chown -Rf :mam . || true ) && \
|
||||
(chmod -Rf g+w . || true ) && \
|
||||
echo 'Reloading apache ... (You may have to start it manually on error!)' && \
|
||||
~/etc/apache2/apache2ctl -k reload && \
|
||||
~/etc/apache2/apache2ctl -k restart && \
|
||||
echo Done."
|
||||
@echo "Test pushed to ${TEST_SERVER}:${TEST_DIR} successfully."
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@ Use git :-)
|
|||
Quickstart
|
||||
----------
|
||||
|
||||
Install the following packages in Debian/Ubuntu: `libpq-dev python-dev python-setuptools python2.7`. Then run:
|
||||
|
||||
make
|
||||
./manage.py testdata
|
||||
make run
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
.header {
|
||||
font-size: 200%;
|
||||
background: #ea3;
|
||||
@import url(http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,400,300,600&subset=latin,latin-ext);
|
||||
|
||||
body {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.org-logged-in .mam-text-plugin {
|
||||
|
@ -39,4 +41,124 @@ table .border-b {
|
|||
height: 6em;
|
||||
}
|
||||
|
||||
/* Headline & Header */
|
||||
|
||||
#headline {
|
||||
padding: 6px 10px;
|
||||
font-size: 150%;
|
||||
font-weight: 400;
|
||||
background: #00c322; /* @mamgreen */
|
||||
}
|
||||
|
||||
#header {
|
||||
position: relative;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.header-lg {
|
||||
font-size: 250%;
|
||||
background-color: rgba(255,195,0,0.8);
|
||||
height: 220px;
|
||||
position: relative;
|
||||
}
|
||||
.header-md {
|
||||
font-size: 250%;
|
||||
background-color: rgba(255,195,0,0.8);
|
||||
height: 220px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#header img.logo {
|
||||
position: absolute;
|
||||
top: 25px;
|
||||
left: 25px;
|
||||
height: 110px;
|
||||
}
|
||||
#header h1 {
|
||||
font-size: 130%;
|
||||
position: absolute;
|
||||
top: 125px;
|
||||
left: 30px;
|
||||
height: 110px;
|
||||
}
|
||||
#header img.header {
|
||||
margin: -25px 20px 0px 0px;
|
||||
height: 145px;
|
||||
float: right;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/* Menu */
|
||||
|
||||
#menu {
|
||||
background: #00c322; /* @mamgreen */
|
||||
border-bottom-left-radius: 8px;
|
||||
border-bottom-right-radius: 8px;
|
||||
}
|
||||
#menu ul {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
#menu li {
|
||||
display: inline-block;
|
||||
border-radius: 0px;
|
||||
|
||||
padding: 0px;
|
||||
width: 16.66%;
|
||||
min-width: 140px;
|
||||
text-align: center;
|
||||
|
||||
font-size: 150%;
|
||||
font-weight: 400;
|
||||
font-variant: small-caps;
|
||||
border-bottom-left-radius: 8px;
|
||||
border-bottom-right-radius: 8px;
|
||||
}
|
||||
#menu a {
|
||||
display: block;
|
||||
padding: 8px 10px;
|
||||
color: black;
|
||||
}
|
||||
#menu a:hover {
|
||||
background: #ffb000;
|
||||
border-bottom-left-radius: 8px;
|
||||
border-bottom-right-radius: 8px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#submenu {
|
||||
/*border: 1px solid black;*/
|
||||
}
|
||||
#submenu ul {
|
||||
padding: 0px 0px;
|
||||
margin: 20px 0px 20px 0px;
|
||||
background: #00c322; /* @mamgreen */
|
||||
border-radius: 8px;
|
||||
list-style-position: inside;
|
||||
width: 100%;
|
||||
}
|
||||
#submenu li {
|
||||
border-radius: 0px;
|
||||
padding: 6px 15px;
|
||||
margin-right: 0px;
|
||||
font-size: 120%;
|
||||
}
|
||||
#submenu li:hover {
|
||||
background: #ffb000;
|
||||
}
|
||||
#submenu li:first-child {
|
||||
border-top-left-radius: 7px;
|
||||
border-top-right-radius: 7px;
|
||||
padding-top: 8px;
|
||||
}
|
||||
#submenu li:last-child {
|
||||
border-bottom-left-radius: 7px;
|
||||
border-bottom-right-radius: 7px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
#submenu li>a {
|
||||
color: #000;
|
||||
}
|
||||
#submenu li>a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
|
BIN
mamweb/static/images/logocb.png
Normal file
BIN
mamweb/static/images/logocb.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
|
@ -30,16 +30,46 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class='header'>
|
||||
<a href="/">Korespondenční seminář M&M</a>
|
||||
<div class='row'>
|
||||
<div class='col-md-12'>
|
||||
<div id="headline">
|
||||
Studentský korespondenční seminář a časopis MFF UK
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-12'>
|
||||
<div id="header">
|
||||
<div class='header-lg visible-lg-block'>
|
||||
<img class="logo" src="{% static 'images/logocb.png' %}" />
|
||||
<h1>Nadpis 1. úrovně</h1>
|
||||
<img class="header" src="{% static 'images/liska6.png' %}" />
|
||||
<!--<a href="/">Korespondenční seminář M&M</a>-->
|
||||
</div>
|
||||
<div class='header-md visible-md-block'>
|
||||
<img class="logo" src="{% static 'images/logocb.png' %}" />
|
||||
<h1>Nadpis 1. úrovně</h1>
|
||||
<img class="header" src="{% static 'images/liska6.png' %}" />
|
||||
<!--<a href="/">Korespondenční seminář M&M</a>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-4' style=''>
|
||||
{% include "menu.html" %}
|
||||
{% block submenu %}
|
||||
{% endblock %}
|
||||
<div class='col-md-12' style=''>
|
||||
<div id='menu'>
|
||||
{% include "menu.html" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-3'>
|
||||
<div id='submenu'>
|
||||
{% block submenu %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-md-8'>
|
||||
<div class='col-md-9'>
|
||||
{% block content %}
|
||||
{% endblock content %}
|
||||
</div>
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
{% load i18n cache mam_menu %}
|
||||
{% aktualni_rocniky as rs %}
|
||||
|
||||
<h2> MENU </h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="/co-je-MaM/uvod/">Co je M&M</a>
|
||||
<li><a href="{% url 'seminar_seznam_soustredeni' %}">Soustředění</a>
|
||||
<li><a href="/zadani/aktualni/">Zadání</a>
|
||||
<li><a href="/clanky/uvod/">Články</a>
|
||||
<li><a href="/archiv/cisla/">Archiv</a>
|
||||
<!-- <li><a href="/odevzdat-reseni/muj-ucet">Odeslat řešení</a>-->
|
||||
<li><a href="/odevzdat-reseni/muj-ucet">Odeslat řešení</a>
|
||||
</ul>
|
||||
|
||||
<!-- TODO smazat <ul>
|
||||
|
|
|
@ -298,6 +298,18 @@ create_modeladmin(ProblemZadanyAdmin, Problem, 'ProblemZadany', verbose_name=u'P
|
|||
|
||||
### Soustredeni
|
||||
|
||||
def zverejnit_soustredeni(modeladmin, request, queryset):
|
||||
for soustredeni in queryset:
|
||||
soustredeni.verejne_db = True
|
||||
soustredeni.save()
|
||||
zverejnit_soustredeni.short_description = 'Zveřejnit soustředění'
|
||||
|
||||
def skryt_soustredeni(modeladmin, request, queryset):
|
||||
for soustredeni in queryset:
|
||||
soustredeni.verejne_db = False
|
||||
soustredeni.save()
|
||||
skryt_soustredeni.short_description = 'Skrýt soustředění (Zneveřjnit)'
|
||||
|
||||
class SoustredeniAdminForm(forms.ModelForm):
|
||||
text = forms.CharField(widget=CKEditorWidget(), required=False, **field_labels(Soustredeni, 'text'))
|
||||
class Meta:
|
||||
|
@ -314,6 +326,7 @@ class SoustredeniAdmin(reversion.VersionAdmin):
|
|||
inlines = [Soustredeni_UcastniciInline]
|
||||
list_filter = ['rocnik']
|
||||
view_on_site = Soustredeni.verejne_url
|
||||
actions = [zverejnit_soustredeni, skryt_soustredeni, ]
|
||||
|
||||
admin.site.register(Soustredeni, SoustredeniAdmin)
|
||||
|
||||
|
@ -333,7 +346,41 @@ admin.site.register(Novinky, NovinkyAdmin)
|
|||
|
||||
### Organizator
|
||||
|
||||
def jmeno_organizatora(obj):
|
||||
''' vraci jmeno organizatora '''
|
||||
jmeno = obj.user.first_name
|
||||
if obj.prezdivka:
|
||||
jmeno = jmeno + ' "' + obj.prezdivka + '"'
|
||||
jmeno = jmeno + ' ' + obj.user.last_name
|
||||
if jmeno == ' ': # zobrazeni bezejmennych orgu
|
||||
return 'org'
|
||||
return jmeno
|
||||
jmeno_organizatora.short_description = 'Jméno organizátora'
|
||||
|
||||
def je_organizator_aktivni(obj):
|
||||
''' zjisti, zda-li je organizator aktivni '''
|
||||
return obj.user.is_active
|
||||
je_organizator_aktivni.short_description = 'Aktivní'
|
||||
je_organizator_aktivni.boolean = True
|
||||
|
||||
def zaktivovat_organizatory(modeladmin, request, queryset):
|
||||
''' vybrane organizatory oznaci jako aktivni '''
|
||||
for org in queryset:
|
||||
org.user.is_active = True
|
||||
org.user.save()
|
||||
zaktivovat_organizatory.short_description = 'Zaktivovat organizátory'
|
||||
|
||||
def deaktivovat_organizatory(modeladmin, request, queryset):
|
||||
''' deaktivuje vybrane organizatory '''
|
||||
for org in queryset:
|
||||
org.user.is_active = False
|
||||
org.user.save()
|
||||
deaktivovat_organizatory.short_description = 'Deaktivovat organizátory'
|
||||
|
||||
|
||||
@admin.register(Organizator)
|
||||
class OrganizatorAdmin(admin.ModelAdmin):
|
||||
list_filter = ['organizuje_do_roku']
|
||||
list_display = [jmeno_organizatora, je_organizator_aktivni,]
|
||||
actions = [zaktivovat_organizatory, deaktivovat_organizatory,]
|
||||
|
||||
|
|
|
@ -7,8 +7,15 @@
|
|||
{# Projdi vsechna soustredeni #}
|
||||
{% for soustredeni in object_list %}
|
||||
{# Kdyz je verejne -> zobraz #}
|
||||
{% if soustredeni.verejne_db %}
|
||||
{# misto a cas soustredeni TODO upravit#}
|
||||
{% if soustredeni.verejne_db or user.is_authenticated %}
|
||||
{% if not soustredeni.verejne_db and user.is_authenticated %}
|
||||
Groups of user: {{user.groups.all}} <br>
|
||||
<!-- TODO pri prihlasovani ucastniku dodelat prava
|
||||
jen na group org ve view -->
|
||||
Toto soustředění není veřejné, vidíte ho jen proto,
|
||||
že jste přihlášení. <br>
|
||||
{% endif %}
|
||||
{# misto soustredeni TODO upravit#}
|
||||
{% if soustredeni.misto %}
|
||||
<h2>
|
||||
Soustředění v {{soustredeni.misto}}
|
||||
|
@ -29,9 +36,6 @@
|
|||
<li>Nic!
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{# Kdyz neni verejne, tak TODO zobraz jen pro prihlasene orgy #}
|
||||
{% else %}
|
||||
{# TODO if org je prihlaseny, predelat na (verejne OR jsem_org) #}
|
||||
{% endif %}
|
||||
{% empty %}
|
||||
Žádná soustředění zatím neproběhla!
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<li><a href="{{cesta}}/aktualni-zadani/">Aktuální zadání</a>
|
||||
<li><a href="{{cesta}}/ulohy/">Úlohy</a>
|
||||
<li><a href="{{cesta}}/temata/">Témata</a>
|
||||
<li><a href="{{cesta}}/aktualni-cislo/">Aktuální Číslo</a>
|
||||
<li><a href="{{cesta}}/aktualni-cislo/">Aktuální číslo</a>
|
||||
<li><a href="{{cesta}}/vysledkove-listiny/">Výsledkové listiny</a>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ urlpatterns = patterns('',
|
|||
url(r'^archiv/cisla/$', views.CislaView.as_view()),
|
||||
|
||||
url(r'^rocnik/(?P<rocnik>\d+)/$', views.RocnikView.as_view(), name='seminar_rocnik'),
|
||||
url(r'^cislo/(?P<rocnik>\d+).(?P<cislo>\d+)/$', views.CisloView.as_view(), name='seminar_cislo'),
|
||||
url(r'^cislo/(?P<rocnik>\d+)\.(?P<cislo>\d+)/$', views.CisloView.as_view(), name='seminar_cislo'),
|
||||
url(r'^problem/(?P<pk>\d+)/$', views.ProblemView.as_view(), name='seminar_problem'),
|
||||
|
||||
url(r'^soustredeni/$', views.SoustredeniListView.as_view(),
|
||||
|
|
|
@ -74,20 +74,26 @@ class CisloView(generic.DetailView):
|
|||
def get_context_data(self, **kwargs):
|
||||
context = super(CisloView, self).get_context_data(**kwargs)
|
||||
|
||||
# Vysledky k cislu: seznam objektu typu (cislo, resitel, body [v tom cisle], body_celkem [od zac. rocniku])
|
||||
vysledky = VysledkyKCislu.objects.filter(cislo = context['cislo']).order_by('-body_celkem').select_related("resitel")
|
||||
|
||||
reseni = Reseni.objects.filter(cislo_body = context['cislo']).select_related("resitel")
|
||||
|
||||
# seznam problemu s nejakymi body v tomto cisle
|
||||
problemy = sorted(list(set([r.problem for r in reseni])), key=lambda x:(0 if x.typ==Problem.TYP_ULOHA else 1,x.kod))
|
||||
#setridi problemy podle typu a poradi zadani
|
||||
# cislo sloupecku pro problem (inverzni funkce)
|
||||
problem_index = {}
|
||||
for i in range(len(problemy)):
|
||||
problem_index[problemy[i].id] = i
|
||||
#umoznuje zjistit index podle id problemu
|
||||
|
||||
# pomocna mapa Resitel: RadekVysledkovky
|
||||
vysledky_resitele = {}
|
||||
stejne_body = {}
|
||||
konec_rozmezi = {}
|
||||
# radky vysledkovky, seznam objektu RadekVysledkovky
|
||||
vysledkovka = []
|
||||
# posledni pocet bodu, pro detekci stejnych mist
|
||||
posledni_body = 100000
|
||||
predchozi_poradi = None
|
||||
|
||||
|
@ -96,8 +102,7 @@ class CisloView(generic.DetailView):
|
|||
tv = RadekVysledkovky()
|
||||
tv.resitel = v.resitel
|
||||
tv.vysledek = v
|
||||
tv.body = ['']*len(problemy)
|
||||
#defaultni hodnota poctu bodu je prazdny retezec
|
||||
tv.body = ['']*len(problemy) # misto pro body za jednotlive uloy
|
||||
tv.poradi = ''
|
||||
#defaultni poradi je prazdne - kvuli sdilenym mistum
|
||||
if posledni_body > v.body_celkem:
|
||||
|
@ -123,6 +128,7 @@ class CisloView(generic.DetailView):
|
|||
vysledky_resitele[v.resitel.id] = tv
|
||||
vysledkovka.append(tv)
|
||||
|
||||
# doplneni bodu za jednotliva reseni lidi do RadekVysledkovky.body
|
||||
for r in reseni:
|
||||
vysledky_resitele[r.resitel.id].body[problem_index[r.problem.id]] = r.body
|
||||
|
||||
|
|
Loading…
Reference in a new issue