Merge branch 'master' of atrey.karlin.mff.cuni.cz:/akce/MaM/MaMweb/mamweb
This commit is contained in:
		
						commit
						cb2ae7ed5e
					
				
					 9 changed files with 161 additions and 52 deletions
				
			
		|  | @ -4,31 +4,10 @@ | ||||||
| 
 | 
 | ||||||
| {% block content %} | {% block content %} | ||||||
| <div> | <div> | ||||||
|   {% if problem.cislo_zadani %} |   {% block problem %} | ||||||
|     <h2> |   {% endblock %} | ||||||
|       {% block nadpis1a %}{% block nadpis1b %} |  | ||||||
|         {{ problem.nazev_typu }} {{ problem.kod_v_rocniku }}: {{ problem.nazev }} {{ problem.body_v_zavorce }} |  | ||||||
|       {% endblock %}{% endblock %} |  | ||||||
|     </h2> |  | ||||||
| 
 | 
 | ||||||
|     <p>Zadáno v čísle <a href='{{ problem.cislo_zadani.verejne_url }}'>{{ problem.cislo_zadani.kod }}</a>. |   {% if user.is_staff %} | ||||||
|     {% if problem.cislo_reseni %} |  | ||||||
|       <p>Řešeno v čísle <a href='{{ problem.cislo_reseni.verejne_url }}'>{{ problem.cislo_reseni.kod }}</a>. |  | ||||||
|     {% endif %} |  | ||||||
|   {% else %} |  | ||||||
|     <h2>Problém {{ problem.nazev }}</h2> |  | ||||||
|   {% endif %} |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|   <h3>Zadání</h3> |  | ||||||
|   {{ problem.text_zadani |safe }} |  | ||||||
|   {% if problem.text_reseni %} |  | ||||||
|     <h3>Řešení</h3> |  | ||||||
|     {{ problem.text_reseni |safe }} |  | ||||||
|   {% endif %} |  | ||||||
| 
 |  | ||||||
|   {# TODO Kontrola, zda je uzivatel org #}  |  | ||||||
|   {% if user.is_authenticated %} |  | ||||||
|   <div class='mam-org-only'> |   <div class='mam-org-only'> | ||||||
| 
 | 
 | ||||||
|     <h3>Text - org</h3> |     <h3>Text - org</h3> | ||||||
|  | @ -43,4 +22,3 @@ | ||||||
| 
 | 
 | ||||||
| </div> | </div> | ||||||
| {% endblock content %} | {% endblock content %} | ||||||
| 
 |  | ||||||
|  |  | ||||||
							
								
								
									
										38
									
								
								seminar/templates/seminar/archiv/problem_clanek.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								seminar/templates/seminar/archiv/problem_clanek.html
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,38 @@ | ||||||
|  | {% extends "seminar/archiv/problem.html" %} | ||||||
|  | 
 | ||||||
|  | {% block problem %} | ||||||
|  |   {% if problem.cislo_zadani %} | ||||||
|  | 
 | ||||||
|  |     <h2> | ||||||
|  |       {{ problem.nazev_typu }}: | ||||||
|  |       {% block nadpis1a %}{% block nadpis1b %} | ||||||
|  |         {{ problem.nazev }} | ||||||
|  |       {% endblock %}{% endblock %} | ||||||
|  |     </h2> | ||||||
|  | 
 | ||||||
|  |     <div class='problem-autori'> | ||||||
|  |     {% if problem.typ == 'res-clanek' %} | ||||||
|  |       {# pozor na mezery #} | ||||||
|  |       {% for r in reseni %}{% if not forloop.first %}, {% endif %} | ||||||
|  |         {{ r.resitel.jmeno }} {{ r.resitel.prijmeni }}{% if r.body %} ({{ r.body }} b){% endif %}{% endfor %} | ||||||
|  |     {% else %} | ||||||
|  |       {{ problem.autor.first_name }} | ||||||
|  |       {% if problem.autor.organizator.prezdivka %} | ||||||
|  |         „{{ problem.autor.organizator.prezdivka }}“ | ||||||
|  |       {% endif %} | ||||||
|  |       {{ problem.autor.last_name }} | ||||||
|  |     {% endif %} | ||||||
|  |     </div> | ||||||
|  | 
 | ||||||
|  |     {% if problem.cislo_reseni %} | ||||||
|  |       <p>Vyšlo v čísle <a href='{{ problem.cislo_reseni.verejne_url }}'>{{ problem.cislo_reseni.kod }}</a>. | ||||||
|  |     {% endif %} | ||||||
|  | 
 | ||||||
|  |   {% else %} | ||||||
|  |     {# TODO ? #} | ||||||
|  |     <h2>Problém {{ problem.nazev }}</h2> | ||||||
|  |   {% endif %} | ||||||
|  | 
 | ||||||
|  |   {{ problem.text_zadani |safe }} | ||||||
|  | 
 | ||||||
|  | {% endblock %} | ||||||
							
								
								
									
										27
									
								
								seminar/templates/seminar/archiv/problem_uloha_tema.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								seminar/templates/seminar/archiv/problem_uloha_tema.html
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,27 @@ | ||||||
|  | {% extends "seminar/archiv/problem.html" %} | ||||||
|  | 
 | ||||||
|  | {% block problem %} | ||||||
|  |     <h2> | ||||||
|  |       {% block nadpis1a %}{% block nadpis1b %} | ||||||
|  |         {{ problem.nazev_typu }} {{ problem.kod_v_rocniku }}: {{ problem.nazev }} {{ problem.body_v_zavorce }} | ||||||
|  |       {% endblock %}{% endblock %} | ||||||
|  |     </h2> | ||||||
|  |   {% if problem.cislo_zadani %} | ||||||
|  |     <p>Zadáno v čísle <a href='{{ problem.cislo_zadani.verejne_url }}'>{{ problem.cislo_zadani.kod }}</a>. | ||||||
|  |     {% if problem.cislo_reseni %} | ||||||
|  |       <p>Řešeno v čísle <a href='{{ problem.cislo_reseni.verejne_url }}'>{{ problem.cislo_reseni.kod }}</a>. | ||||||
|  |     {% endif %} | ||||||
|  |   {% else %} | ||||||
|  |     {# TODO ? #} | ||||||
|  |     <h2>Problém {{ problem.nazev }}</h2> | ||||||
|  |   {% endif %} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |   <h3>Zadání</h3> | ||||||
|  |   {{ problem.text_zadani |safe }} | ||||||
|  |   {% if problem.text_reseni %} | ||||||
|  |     <h3>Řešení</h3> | ||||||
|  |     {{ problem.text_reseni |safe }} | ||||||
|  |   {% endif %} | ||||||
|  | 
 | ||||||
|  | {% endblock %} | ||||||
|  | @ -0,0 +1,5 @@ | ||||||
|  | {% extends 'seminar/clanky/resitelske_clanky.html' %} | ||||||
|  | 
 | ||||||
|  | {% block nadpis1a %}{% block nadpis1b %} | ||||||
|  | Organizátorské články | ||||||
|  | {% endblock %}{% endblock %} | ||||||
							
								
								
									
										24
									
								
								seminar/templates/seminar/clanky/resitelske_clanky.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								seminar/templates/seminar/clanky/resitelske_clanky.html
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,24 @@ | ||||||
|  | {% extends 'base.html' %} | ||||||
|  | 
 | ||||||
|  | {% block content %} | ||||||
|  | 
 | ||||||
|  | <h2> | ||||||
|  | {% block nadpis1a %}{% block nadpis1b %} | ||||||
|  | Řešitelské články | ||||||
|  | {% endblock %}{% endblock %} | ||||||
|  | </h2> | ||||||
|  | 
 | ||||||
|  | {% for clanek in object_list %} | ||||||
|  | {% with clanek.cislo_zadani.rocnik.rocnik as rocnik %} | ||||||
|  |   {% ifchanged rocnik %} | ||||||
|  |     {% if not forloop.first %}</ul>{% endif %} | ||||||
|  |     <h3>{{ rocnik }}. ročník</h3> | ||||||
|  |     <ul> | ||||||
|  |   {% endifchanged %} | ||||||
|  |       <li> | ||||||
|  |         <a href="{{ clanek.verejne_url }}">{{ clanek.nazev }}</a> | ||||||
|  | {% endwith %} | ||||||
|  | {% endfor %} | ||||||
|  | </ul> | ||||||
|  | 
 | ||||||
|  | {% endblock %} | ||||||
|  | @ -3,8 +3,8 @@ | ||||||
| <div id='submenu'> | <div id='submenu'> | ||||||
| <ul> | <ul> | ||||||
|   <li class="{% if selected == "uvod" %}selected{% endif %}"><a href="{{cesta}}/uvod/">Úvod</a> |   <li class="{% if selected == "uvod" %}selected{% endif %}"><a href="{{cesta}}/uvod/">Úvod</a> | ||||||
|   {# TODO až budou <li class="{% if selected == "org" %}selected{% endif %}"><a href="{{cesta}}/org/">Organizátorské články</a> #} |   <li class="{% if selected == "org" %}selected{% endif %}"><a href="{{cesta}}/org/">Organizátorské články</a> | ||||||
|   {# TODO až budou <li class="{% if selected == "resitel" %}selected{% endif %}"><a href="{{cesta}}/resitel/">Řešitelské články</a> #} |   <li class="{% if selected == "resitel" %}selected{% endif %}"><a href="{{cesta}}/resitel/">Řešitelské články</a> | ||||||
|   <li class="{% if selected == "jak-psat-vedecky-clanek" %}selected{% endif %}"><a href="{{cesta}}/jak-psat-vedecky-clanek/">Jak napsat článek</a> |   <li class="{% if selected == "jak-psat-vedecky-clanek" %}selected{% endif %}"><a href="{{cesta}}/jak-psat-vedecky-clanek/">Jak napsat článek</a> | ||||||
| </ul> | </ul> | ||||||
| </div> | </div> | ||||||
|  |  | ||||||
|  | @ -9,13 +9,13 @@ | ||||||
| 
 | 
 | ||||||
| {# zmena fotky #}{% block header %}soustredeni{% endblock %} | {# zmena fotky #}{% block header %}soustredeni{% endblock %} | ||||||
| 
 | 
 | ||||||
| {% block content %}{% if user.is_authenticated %}{# PRACUJE SE STRANKA #} | {% block nadpis1a %}{% block nadpis1b %} | ||||||
|  |   Soustředění | ||||||
|  | {% endblock %}{% endblock %} | ||||||
|  | 
 | ||||||
|  | {% block content %} | ||||||
|  | {#% if user.is_authenticated %#}{# PRACUJE SE STRANKA #} | ||||||
| 
 | 
 | ||||||
|   <h2> |  | ||||||
|     {% block nadpis1a %}{% block nadpis1b %} |  | ||||||
|       Soustředění |  | ||||||
|     {% endblock %}{% endblock %} |  | ||||||
|   </h2> |  | ||||||
| 
 | 
 | ||||||
|   {# Projdi vsechna soustredeni #} |   {# Projdi vsechna soustredeni #} | ||||||
|   {% for soustredeni in object_list %} |   {% for soustredeni in object_list %} | ||||||
|  | @ -29,30 +29,36 @@ | ||||||
|         že jste přihlášení. <br> |         že jste přihlášení. <br> | ||||||
|       {% endif %} |       {% endif %} | ||||||
|       {# misto soustredeni TODO upravit#} |       {# misto soustredeni TODO upravit#} | ||||||
|       {% if soustredeni.misto %} |  | ||||||
|         <h2> |         <h2> | ||||||
|           Soustředění v {{soustredeni.misto}} | 	  {{soustredeni.get_typ_display}}  | ||||||
|           od {{soustredeni.datum_zacatku}} do {{soustredeni.datum_konce}} | 	  {{soustredeni.misto}} | ||||||
|           při {{soustredeni.rocnik.rocnik}}. ročníku M&M |  | ||||||
|         </h2> |         </h2> | ||||||
|  | 	<ul> | ||||||
|  | 	<li> | ||||||
|  | 		{{soustredeni.datum_zacatku}} – {{soustredeni.datum_konce}} | ||||||
|  | 	</li> | ||||||
|  | 	</ul> | ||||||
|  |       {% if user.is_authenticated %} | ||||||
|  |         {# popis soustredeni #} | ||||||
|  |         {% if soustredeni.text %} | ||||||
|  |           {% autoescape off %}{{soustredeni.text}}{% endautoescape %} | ||||||
|  |         {% endif %} | ||||||
|  |         {# Účastníci #} | ||||||
|  |         <h3>Soustředění se zúčastnili tito účastníci:</h3> | ||||||
|  |         <ul> | ||||||
|  |         {% for i in soustredeni.soustredeni_ucastnici_set.all %} | ||||||
|  |           <li>{{i.resitel}} | ||||||
|  |         {% empty %} | ||||||
|  |           <li>Nic! | ||||||
|  |         {% endfor %} | ||||||
|  |         </ul> | ||||||
|       {% endif %} |       {% endif %} | ||||||
|       {# popis soustredeni #} |  | ||||||
|       {% if soustredeni.text %} |  | ||||||
|         {% autoescape off %}{{soustredeni.text}}{% endautoescape %} |  | ||||||
|       {% endif %} |  | ||||||
|       {# Účastníci #} |  | ||||||
|       <h3>Soustředění se zúčastnili tito účastníci:</h3> |  | ||||||
|       <ul> |  | ||||||
|       {% for i in soustredeni.soustredeni_ucastnici_set.all %} |  | ||||||
|         <li>{{i.resitel}} |  | ||||||
|       {% empty %} |  | ||||||
|         <li>Nic! |  | ||||||
|       {% endfor %} |  | ||||||
|       </ul> |  | ||||||
|     {% endif %} |     {% endif %} | ||||||
|   {% empty %} |   {% empty %} | ||||||
|     Žádná soustředění zatím neproběhla! |     Žádná soustředění zatím neproběhla! | ||||||
|   {% endfor %} |   {% endfor %} | ||||||
| 
 | 
 | ||||||
| {% else %}{% include 'seminar/pracuje_se.html' %}{% endif %}{% endblock %} | {#% else %}{% include 'seminar/pracuje_se.html' %}{% endif %#} | ||||||
|  | 
 | ||||||
|  | {% endblock %} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -22,6 +22,10 @@ urlpatterns = patterns('', | ||||||
|     url(r'^$', views.TitulniStranaView.as_view(), name='titulni_strana'), |     url(r'^$', views.TitulniStranaView.as_view(), name='titulni_strana'), | ||||||
|     url(r'^stare-novinky/$', views.StareNovinkyView.as_view(), name='stare_novinky'), |     url(r'^stare-novinky/$', views.StareNovinkyView.as_view(), name='stare_novinky'), | ||||||
| 
 | 
 | ||||||
|  |     url(r'^clanky/resitel/$', views.ClankyResitelView.as_view(), name='clanky_resitel'), | ||||||
|  |     url(r'^clanky/org/$', views.ClankyOrganizatorView.as_view(), name='clanky_organizator'), | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|     url(r'^stav$', views.StavDatabazeView, name='stav_databaze'), |     url(r'^stav$', views.StavDatabazeView, name='stav_databaze'), | ||||||
| 
 | 
 | ||||||
|     url(r'^aesop-export/mam-rocnik-(?P<prvni_rok>\d+)\.csv$', export.ExportRocnikView.as_view(), name='seminar_export_rocnik'), |     url(r'^aesop-export/mam-rocnik-(?P<prvni_rok>\d+)\.csv$', export.ExportRocnikView.as_view(), name='seminar_export_rocnik'), | ||||||
|  |  | ||||||
|  | @ -159,9 +159,23 @@ class RocnikView(generic.DetailView): | ||||||
|             context['temata_v_rocniku'] = temata_v_rocniku |             context['temata_v_rocniku'] = temata_v_rocniku | ||||||
|         return context |         return context | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| class ProblemView(generic.DetailView): | class ProblemView(generic.DetailView): | ||||||
|     model = Problem |     model = Problem | ||||||
|     template_name = 'seminar/archiv/problem.html' | 
 | ||||||
|  |     def _je_clanek(self, problem): | ||||||
|  |         return problem.typ in [Problem.TYP_ORG_CLANEK, Problem.TYP_RES_CLANEK] | ||||||
|  | 
 | ||||||
|  |     def get_template_names(self, **kwargs): | ||||||
|  |         context = super(ProblemView, self).get_context_data(**kwargs) | ||||||
|  |         return ['seminar/archiv/problem_' + ('clanek.html' if self._je_clanek(context['problem']) else 'uloha_tema.html')] | ||||||
|  | 
 | ||||||
|  |     def get_context_data(self, **kwargs): | ||||||
|  |         context = super(ProblemView, self).get_context_data(**kwargs) | ||||||
|  |         if context['problem'].typ == Problem.TYP_RES_CLANEK: | ||||||
|  |             context['reseni'] = Reseni.objects.filter(problem=context['problem']).select_related('resitel').order_by('resitel__prijmeni') | ||||||
|  |         return context | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| class RadekVysledkovky(object): | class RadekVysledkovky(object): | ||||||
|     pass |     pass | ||||||
|  | @ -271,6 +285,19 @@ class SoustredeniView(generic.DetailView): | ||||||
|     model = Soustredeni |     model = Soustredeni | ||||||
|     template_name = 'seminar/archiv/soustredeni.html' |     template_name = 'seminar/archiv/soustredeni.html' | ||||||
| 
 | 
 | ||||||
|  | ### Články | ||||||
|  | 
 | ||||||
|  | class ClankyResitelView(generic.ListView): | ||||||
|  |     model = Problem | ||||||
|  |     template_name = 'seminar/clanky/resitelske_clanky.html' | ||||||
|  |     queryset = Problem.objects.filter(typ=Problem.TYP_RES_CLANEK, stav=Problem.STAV_ZADANY).select_related('cislo_zadani__rocnik__rocnik').order_by('-cislo_zadani__rocnik__rocnik', 'kod') | ||||||
|  | 
 | ||||||
|  | class ClankyOrganizatorView(generic.ListView): | ||||||
|  |     model = Problem | ||||||
|  |     template_name = 'seminar/clanky/organizatorske_clanky.html' | ||||||
|  |     queryset = Problem.objects.filter(typ=Problem.TYP_ORG_CLANEK, stav=Problem.STAV_ZADANY).select_related('cislo_zadani__rocnik__rocnik').order_by('-cislo_zadani__rocnik__rocnik', 'kod') | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| ### Status | ### Status | ||||||
| 
 | 
 | ||||||
| def StavDatabazeView(request): | def StavDatabazeView(request): | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Honza "Stínovlas" Musílek
						Honza "Stínovlas" Musílek