Merge branch 'master' of atrey.karlin.mff.cuni.cz:/akce/MaM/MaMweb/mamweb
Conflicts: mamweb/templates/menu.html seminar/templates/seminar/novinky.html seminar/views.py
This commit is contained in:
		
						commit
						d64cd84e6a
					
				
					 42 changed files with 584 additions and 330 deletions
				
			
		|  | @ -18,7 +18,7 @@ SITE_ID = 1 | |||
| ROOT_URLCONF = 'mamweb.urls' | ||||
| WSGI_APPLICATION = 'mamweb.wsgi.application' | ||||
| 
 | ||||
| APPEND_SLASH = False | ||||
| APPEND_SLASH = True | ||||
| 
 | ||||
| # Internationalization | ||||
| # https://docs.djangoproject.com/en/1.7/topics/i18n/ | ||||
|  |  | |||
							
								
								
									
										16
									
								
								mamweb/static/css/bootstrap.css
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								mamweb/static/css/bootstrap.css
									
									
									
									
										vendored
									
									
								
							|  | @ -1403,11 +1403,11 @@ pre code { | |||
|     width: 970px; | ||||
|   } | ||||
| } | ||||
| @media (min-width: 1200px) { | ||||
| /*@media (min-width: 1200px) { | ||||
|   .container { | ||||
|     width: 1170px; | ||||
|   } | ||||
| } | ||||
| }*/ | ||||
| .container-fluid { | ||||
|   padding-right: 15px; | ||||
|   padding-left: 15px; | ||||
|  | @ -1896,7 +1896,7 @@ pre code { | |||
|     margin-left: 0; | ||||
|   } | ||||
| } | ||||
| @media (min-width: 1200px) { | ||||
| /*@media (min-width: 1200px) { | ||||
|   .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { | ||||
|     float: left; | ||||
|   } | ||||
|  | @ -2053,7 +2053,7 @@ pre code { | |||
|   .col-lg-offset-0 { | ||||
|     margin-left: 0; | ||||
|   } | ||||
| } | ||||
| }*/ | ||||
| table { | ||||
|   background-color: transparent; | ||||
| } | ||||
|  | @ -6232,7 +6232,7 @@ button.close { | |||
|     display: inline-block !important; | ||||
|   } | ||||
| } | ||||
| @media (min-width: 1200px) { | ||||
| /*@media (min-width: 1200px) { | ||||
|   .visible-lg { | ||||
|     display: block !important; | ||||
|   } | ||||
|  | @ -6261,7 +6261,7 @@ button.close { | |||
|   .visible-lg-inline-block { | ||||
|     display: inline-block !important; | ||||
|   } | ||||
| } | ||||
| }*/ | ||||
| @media (max-width: 767px) { | ||||
|   .hidden-xs { | ||||
|     display: none !important; | ||||
|  | @ -6277,11 +6277,11 @@ button.close { | |||
|     display: none !important; | ||||
|   } | ||||
| } | ||||
| @media (min-width: 1200px) { | ||||
| /*@media (min-width: 1200px) { | ||||
|   .hidden-lg { | ||||
|     display: none !important; | ||||
|   } | ||||
| } | ||||
| }*/ | ||||
| .visible-print { | ||||
|   display: none !important; | ||||
| } | ||||
|  |  | |||
|  | @ -33,6 +33,18 @@ table .border-b { | |||
|   border: solid 2px; | ||||
| } | ||||
| 
 | ||||
| div.container { | ||||
| 	background-color: #fff8eb; | ||||
| 	padding: 0px; | ||||
| } | ||||
| 
 | ||||
| div.content { | ||||
| 	padding: 15px 30px; | ||||
| } | ||||
| 
 | ||||
| h2 { | ||||
| 	margin-top: 0px; | ||||
| } | ||||
| 
 | ||||
| /* Comments */ | ||||
| 
 | ||||
|  | @ -43,36 +55,17 @@ table .border-b { | |||
| 
 | ||||
| /* Headline & Header */ | ||||
| 
 | ||||
| #headline { | ||||
| 	padding: 6px 10px; | ||||
| 	font-size: 150%; | ||||
| 	font-weight: 400; | ||||
| 	background: #00c322; /* @mamgreen */ | ||||
| } | ||||
| 
 | ||||
| #header { | ||||
| 	position: relative; | ||||
| 	z-index: -1; | ||||
| 	font-size: 250%; | ||||
| 	background: url("../images/header-bg.png") no-repeat left top; | ||||
| 	height: 353px; | ||||
| 	top: -1px; | ||||
| } | ||||
| 
 | ||||
| .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; | ||||
| 	top: 20px; | ||||
| 	left: 45px; | ||||
| } | ||||
| #header h1 { | ||||
| 	font-size: 130%; | ||||
|  | @ -91,9 +84,10 @@ table .border-b { | |||
| /* Menu */ | ||||
| 
 | ||||
| #menu { | ||||
| 	background: #00c322; /* @mamgreen */ | ||||
| 	border-bottom-left-radius: 8px; | ||||
| 	border-bottom-right-radius: 8px; | ||||
| 	position: relative; | ||||
| 	top: -1px; | ||||
| 	background: url("../images/menu-bg-vertical.png") no-repeat left top, url("../images/menu-bg-horizontal.png") repeat-x left top; | ||||
| 	background-color: #ffb52d; | ||||
| } | ||||
| #menu ul { | ||||
| 	padding: 0px; | ||||
|  | @ -117,36 +111,41 @@ table .border-b { | |||
| #menu a { | ||||
| 	display: block; | ||||
| 	padding: 8px 10px; | ||||
| 	color: black; | ||||
| 	color: #006400; | ||||
| } | ||||
| #menu a:hover { | ||||
| 	background: #ffb000; | ||||
| 	border-bottom-left-radius: 8px; | ||||
| 	border-bottom-right-radius: 8px; | ||||
| 	background: url("../images/submenu-bg-vertical.png") no-repeat left top, url("../images/submenu-bg-horizontal.png") repeat-x left top; | ||||
| 	background-color: #ffa500; | ||||
| 	text-decoration: none; | ||||
| 	color: #003c00; | ||||
| } | ||||
| #menu a.selected { | ||||
| 	color: #003c00; | ||||
| } | ||||
| 
 | ||||
| #submenu { | ||||
| 	/*border: 1px solid black;*/ | ||||
| 	position: relative; | ||||
| 	top: -1px; | ||||
| 	background: url("../images/submenu-bg-vertical.png") no-repeat left top, url("../images/submenu-bg-horizontal.png") repeat-x left top; | ||||
| 	background-color: #ffa500; | ||||
| } | ||||
| #submenu ul { | ||||
| 	padding: 0px 0px; | ||||
| 	margin: 20px 0px 20px 0px; | ||||
| 	background: #00c322; /* @mamgreen */ | ||||
| 	border-radius: 8px; | ||||
| 	list-style-position: inside; | ||||
| 	width: 100%; | ||||
| 	padding: 0px 15px; | ||||
| 	font-size: 150%; | ||||
| 	font-weight: 400; | ||||
| } | ||||
| #submenu li { | ||||
| 	border-radius: 0px; | ||||
| 	padding: 6px 15px; | ||||
| 	margin-right: 0px; | ||||
| 	font-size: 120%; | ||||
| 	padding: 6px 20px; | ||||
| 	display: inline-block; | ||||
| } | ||||
| #submenu li:hover { | ||||
| 	background: #ffb000; | ||||
| #submenu li>a { | ||||
| 	color: #003c00; | ||||
| 	text-decoration: none; | ||||
| } | ||||
| #submenu li:first-child { | ||||
| #submenu li>a:hover { | ||||
| 	color: #3c003c; | ||||
| } | ||||
| /*#submenu li:first-child { | ||||
| 	border-top-left-radius: 7px; | ||||
| 	border-top-right-radius: 7px; | ||||
| 	padding-top: 8px; | ||||
|  | @ -156,9 +155,6 @@ table .border-b { | |||
| 	border-bottom-right-radius: 7px; | ||||
| 	padding-bottom: 8px; | ||||
| } | ||||
| #submenu li>a { | ||||
| 	color: #000; | ||||
| } | ||||
| #submenu li>a:hover { | ||||
| 	text-decoration: none; | ||||
| } | ||||
| }*/ | ||||
|  |  | |||
							
								
								
									
										
											BIN
										
									
								
								mamweb/static/images/header-bg.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								mamweb/static/images/header-bg.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 679 KiB | 
							
								
								
									
										
											BIN
										
									
								
								mamweb/static/images/logo.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								mamweb/static/images/logo.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 50 KiB | 
							
								
								
									
										
											BIN
										
									
								
								mamweb/static/images/menu-bg-horizontal.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								mamweb/static/images/menu-bg-horizontal.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 239 B | 
							
								
								
									
										
											BIN
										
									
								
								mamweb/static/images/menu-bg-vertical.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								mamweb/static/images/menu-bg-vertical.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 572 B | 
							
								
								
									
										
											BIN
										
									
								
								mamweb/static/images/submenu-bg-horizontal.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								mamweb/static/images/submenu-bg-horizontal.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 239 B | 
							
								
								
									
										
											BIN
										
									
								
								mamweb/static/images/submenu-bg-vertical.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								mamweb/static/images/submenu-bg-vertical.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 653 B | 
|  | @ -3,7 +3,12 @@ | |||
| {% load staticfiles %} | ||||
| 
 | ||||
| {% block content %} | ||||
|   <h2>{% block nadpis1 %}Požadovaná stránka nenalezena{% endblock%}</h2> | ||||
|   <h2> | ||||
|     {% block nadpis1a %}{% block nadpis1b %} | ||||
|       Požadovaná stránka nenalezena | ||||
|     {% endblock %}{% endblock%} | ||||
|   </h2> | ||||
| 
 | ||||
|   <p> | ||||
|     Tuto stránku jsme na našem servru nenalezli. | ||||
|     Zkuste přejít na <a href="/">titulní stránku</a> | ||||
|  |  | |||
|  | @ -3,7 +3,12 @@ | |||
| {% load staticfiles %} | ||||
| 
 | ||||
| {% block content %} | ||||
|   <h2>{% block nadpis1 %}O-jo-jo-jo-joj{% endblock %}</h2> | ||||
|   <h2> | ||||
|     {% block nadpis1a %}{% block nadpis1b %} | ||||
|       O-jo-jo-jo-joj | ||||
|     {% endblock %}{% endblock %} | ||||
|   </h2> | ||||
| 
 | ||||
|   <p> | ||||
|     Chybička se vloudila. | ||||
|     Zkuste přejít na <a href="/">titulní stránku</a> | ||||
|  |  | |||
|  | @ -16,10 +16,22 @@ | |||
|     <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}fluent_comments/css/ajaxcomments.css" /> | ||||
|     <script type="text/javascript" src="{{ STATIC_URL }}fluent_comments/js/ajaxcomments.js"></script> | ||||
| 
 | ||||
|     {# nastavení MathJaxu, aby nahrazoval i matiku obalenou jednoduchými $ #} | ||||
|     <script type="text/x-mathjax-config"> | ||||
|       MathJax.Hub.Config({ | ||||
|         tex2jax: { | ||||
|           inlineMath: [['$','$'], ['\\(','\\)']], | ||||
|           processEscapes: true | ||||
|         } | ||||
|       }); | ||||
|     </script> | ||||
|     <script type="text/javascript" | ||||
|       src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> | ||||
|     </script> | ||||
| 
 | ||||
|   </head> | ||||
|   <body class='{% if user.is_authenticated %}org-logged-in{% endif %}'> | ||||
|   {# TODO predelat pro pouze pro orgy (misto pro prihlasene) #} | ||||
|   {% if user.is_authenticated %}  | ||||
|   <body class='{% if user.is_staff %}org-logged-in{% endif %}'> | ||||
|   {% if user.is_staff %} | ||||
|     <div class="login-bar" style='background: #F80;'> | ||||
|       {% if view.object %} | ||||
| 	Objekt {{ view.object }}: {{ view.object }} | ||||
|  | @ -35,48 +47,44 @@ | |||
|     <div class="container"> | ||||
| 	  <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>{% block nadpis1 %}Nadpis 1. úrovně{% endblock %}</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> | ||||
|           <a href='/'> | ||||
| 	  	    <div id="header"> | ||||
| 		      <img class="logo" src="{% static 'images/logo.png' %}" /> | ||||
|               <!--<h1>{% block nadpis1b %}Nadpis 1. úrovně{% endblock %}</h1>--> | ||||
|             </div> | ||||
|             </a> | ||||
|         </div> | ||||
|       </div> | ||||
|       <div class='row'> | ||||
| 	    <div class='col-md-12' style=''> | ||||
| 	      <div id='menu'> | ||||
| 	        {% include "menu.html" %} | ||||
|           {# ============= MENU ============== #} | ||||
|           <ul> | ||||
|             <li class="{% block menu_uvod %}{% endblock %}"><a href="/co-je-MaM/uvod/">Co je M&M</a> | ||||
|             <li class="{% block menu_soustredeni %}{% endblock %}"><a href="{% url 'seminar_seznam_soustredeni' %}">Soustředění</a> | ||||
|             <li class="{% block menu_zadani %}{% endblock %}"><a href="/zadani/aktualni/">Zadání</a> | ||||
|             <li class="{% block menu_clanky %}{% endblock %}"><a href="/clanky/uvod/">Články</a> | ||||
|             <li class="{% block menu_archiv %}{% endblock %}"><a href="/archiv/cisla/">Archiv</a> | ||||
|             <li class="{% block menu_odevzdat %}{% endblock %}">{#<a href="/odevzdat-reseni/muj-ucet">#}Odeslat řešení{#</a>#} | ||||
|           </ul> | ||||
|           {# ======== KONEC MENU =============#} | ||||
| 	      </div> | ||||
| 	    </div> | ||||
| 	  </div> | ||||
| 	  <div class='row'> | ||||
| 	<div class='col-md-3'> | ||||
| 		<div id='submenu'> | ||||
| 		  {% block submenu %} | ||||
| 		  {% endblock %} | ||||
| 		</div> | ||||
| 	</div> | ||||
| 	<div class='col-md-9'> | ||||
| 	  {% block content %} | ||||
| 	  {% endblock content %} | ||||
| 	</div> | ||||
|       </div> | ||||
| 	    <div class='col-md-12'> | ||||
| 		  <div id='submenu'> | ||||
| 		    {% block submenu %} | ||||
| 		    {% endblock %} | ||||
| 		  </div> | ||||
| 	    </div> | ||||
| 	  </div> | ||||
| 	<div class='row content'> | ||||
| 	  <div class='col-md-12'> | ||||
| 	    {% block content %} | ||||
| 	    {% endblock content %} | ||||
| 	  </div> | ||||
|     </div> | ||||
|     </div> | ||||
|     <script src="{% static 'js/bootstrap.js' %}"></script> | ||||
|     <script src="{% static 'js/jquery.jcarousel-core.js' %}" type="text/javascript"></script> | ||||
|  |  | |||
|  | @ -3,27 +3,102 @@ | |||
| {% block title %}{{ flatpage.title }}{% endblock title %} | ||||
| 
 | ||||
| {% block content %} | ||||
| <h2>{% block nadpis1 %}{{ flatpage.title }}{% endblock %}</h2> | ||||
| <h2> | ||||
|   {% block nadpis1a %}{% block nadpis1b%} | ||||
|     {{ flatpage.title }} | ||||
|   {% endblock %}{% endblock %} | ||||
| </h2> | ||||
| 
 | ||||
| <div> | ||||
| {{ flatpage.content }} | ||||
| </div> | ||||
| {% endblock content %} | ||||
| 
 | ||||
| {# nahraj spravne submenu #} | ||||
| {% block submenu %} | ||||
|   {# co-je-MaM #} | ||||
|   {% if "/co-je-MaM/" in flatpage.url %} | ||||
|     {% include "seminar/cojemam/submenu.html" %} | ||||
|     {% if "/uvod/" in flatpage.url %} | ||||
|       {% with "uvod" as selected %} | ||||
|       {% include "seminar/cojemam/submenu.html" %} | ||||
|       {% endwith %} | ||||
|     {% elif "jak-resit" in flatpage.url %} | ||||
|       {% with "jak-resit" as selected %} | ||||
|       {% include "seminar/cojemam/submenu.html" %} | ||||
|       {% endwith %} | ||||
|     {% elif "FAQ" in flatpage.url %} | ||||
|       {% with "FAQ" as selected %} | ||||
|       {% include "seminar/cojemam/submenu.html" %} | ||||
|       {% endwith %} | ||||
|     {% else %} | ||||
|       {% include "seminar/cojemam/submenu.html" %} | ||||
|     {% endif %} | ||||
|   {% endif %} | ||||
|   {# soustredeni #} | ||||
|   {% if "/soustredeni/" in flatpage.url %} | ||||
|     {% include "seminar/soustredeni/submenu.html" %} | ||||
|     {% if "/pripravujeme/" in flatpage.url %} | ||||
|       {% with "pripravujeme" as selected %} | ||||
|       {% include "seminar/soustredeni/submenu.html" %} | ||||
|       {% endwith %} | ||||
|     {% else %} | ||||
|       {% with "uvod" as selected %} | ||||
|       {% include "seminar/soustredeni/submenu.html" %} | ||||
|       {% endwith %} | ||||
|     {% endif %} | ||||
|   {% endif %} | ||||
|   {# zadani #} | ||||
|   {% if "/zadani/" in flatpage.url %} | ||||
|     {% include "seminar/zadani/submenu.html" %} | ||||
|     {% if "/ulohy/" in flatpage.url %} | ||||
|       {% with "ulohy" as selected %} | ||||
|       {% include "seminar/zadani/submenu.html" %} | ||||
|       {% endwith %} | ||||
|     {% elif "/aktualni-cislo/" in flatpage.url %} | ||||
|       {% with "aktualni-cislo" as selected %} | ||||
|       {% include "seminar/zadani/submenu.html" %} | ||||
|       {% endwith %} | ||||
|     {% elif "/vysledkove-listiny/" in flatpage.url %} | ||||
|       {% with "vysledkove-listiny" as selected %} | ||||
|       {% include "seminar/zadani/submenu.html" %} | ||||
|       {% endwith %} | ||||
|     {% else %} | ||||
|       {% include "seminar/zadani/submenu.html" %} | ||||
|     {% endif %} | ||||
|   {% endif %} | ||||
|   {# clanky #} | ||||
|   {% if "/clanky/" in flatpage.url %} | ||||
|     {% include "seminar/clanky/submenu.html" %} | ||||
|     {% if "/uvod/" in flatpage.url %} | ||||
|       {% with "uvod" as selected %} | ||||
|       {% include "seminar/clanky/submenu.html" %} | ||||
|       {% endwith %} | ||||
|     {% elif "/org/" in flatpage.url %} | ||||
|       {% with "org" as selected %} | ||||
|       {% include "seminar/clanky/submenu.html" %} | ||||
|       {% endwith %} | ||||
|     {% elif "/resitel/" in flatpage.url %} | ||||
|       {% with "resitel" as selected %} | ||||
|       {% include "seminar/clanky/submenu.html" %} | ||||
|       {% endwith %} | ||||
|     {% else %} | ||||
|       {% include "seminar/clanky/submenu.html" %} | ||||
|     {% endif %} | ||||
|   {% endif %} | ||||
|   {# archiv #} | ||||
|   {% if "/archiv/" in flatpage.url %} | ||||
|     {% include "seminar/archiv/submenu.html" %} | ||||
|     {% if "/ulohy/" in flatpage.url %} | ||||
|       {% with "ulohy" as selected %} | ||||
|       {% include "seminar/archiv/submenu.html" %} | ||||
|       {% endwith %} | ||||
|     {% else %} | ||||
|       {% include "seminar/archiv/submenu.html" %} | ||||
|     {% endif %} | ||||
|   {% endif %} | ||||
| {% endblock %} | ||||
| 
 | ||||
| {# zvirazneni menu #} | ||||
| {% block menu_uvod %}{% if "/co-je-MaM/" in flatpage.url %}selected{% endif %}{% endblock %} | ||||
| {% block menu_soustredeni %}{% if "/soustredeni/" in flatpage.url %}selected{% endif %}{% endblock %} | ||||
| {% block menu_zadani %}{% if "/zadani/" in flatpage.url %}selected{% endif %}{% endblock %} | ||||
| {% block menu_clanky %}{% if "/clanky/" in flatpage.url %}selected{% endif %}{% endblock %} | ||||
| {% block menu_archiv %}{% if "/archiv/" in flatpage.url %}selected{% endif %}{% endblock %} | ||||
| 
 | ||||
| {# TODO zvirazneni submenu #} | ||||
|  |  | |||
|  | @ -360,8 +360,34 @@ class NovinkyAdminForm(forms.ModelForm): | |||
|         model = Novinky | ||||
|         exclude = [] | ||||
| 
 | ||||
| def zverejnit_novinky(modeladmin, request, queryset): | ||||
|     ''' zverejni vybrane novinky ''' | ||||
|     for novinka in queryset: | ||||
|         novinka.zverejneno = True | ||||
|         novinka.save() | ||||
|     zverejnit_novinky.short_description = 'Zveřejnit vybané novinky' | ||||
| 
 | ||||
| def zneverejnit_novinky(modeladmin, request, queryset): | ||||
|     ''' zneverejni vybrane novinky''' | ||||
|     for novinka in queryset: | ||||
|         novinka.zverejneno = False | ||||
|         novinka.save() | ||||
|     zneverejnit_novinky.short_description = 'Zneveřejnit vybrané novinky' | ||||
| 
 | ||||
| 
 | ||||
| class NovinkyAdmin(admin.ModelAdmin): | ||||
|     form = NovinkyAdminForm | ||||
|     list_display = ['datum', 'autor', 'text', 'zverejneno', 'obrazek'] | ||||
|     actions = [zverejnit_novinky, zneverejnit_novinky] | ||||
| 
 | ||||
|     # předvyplnění přihlášeného uživatele jako autora novinky | ||||
|     def formfield_for_foreignkey(self, db_field, request, **kwargs): | ||||
|         if db_field.name == 'autor': | ||||
|             kwargs['initial'] = request.user.id | ||||
|         return super(NovinkyAdmin, self).formfield_for_foreignkey( | ||||
|             db_field, request, **kwargs | ||||
|         ) | ||||
| 
 | ||||
| 
 | ||||
| admin.site.register(Novinky, NovinkyAdmin) | ||||
| 
 | ||||
|  |  | |||
|  | @ -453,6 +453,9 @@ class Problem(SeminarModelBase): | |||
|             return force_unicode(u"t%s" % (self.kod,)) | ||||
|         return '' | ||||
| 
 | ||||
|     def nazev_typu(self): | ||||
|         return dict(self.TYP_CHOICES)[self.typ] | ||||
| 
 | ||||
|     def verejne(self): | ||||
|         return (self.cislo_zadani and self.cislo_zadani.verejne()) | ||||
|     verejne.boolean = True | ||||
|  | @ -466,6 +469,9 @@ class Problem(SeminarModelBase): | |||
|         else: | ||||
|             return reverse('admin:seminar_problemnavrh_change', args=(self.id, )) | ||||
| 
 | ||||
|     def body_v_zavorce(self): | ||||
|         return u"({}\u2009b)".format(self.body) if self.body else "" | ||||
| 
 | ||||
| 
 | ||||
| @reversion.register(ignore_duplicate_revisions=True) | ||||
| @python_2_unicode_compatible | ||||
|  | @ -756,7 +762,7 @@ class Organizator(models.Model): | |||
|             null = True, blank = True) | ||||
|     foto = models.ImageField('Fotografie organizátora', | ||||
|             upload_to='image_organizatori/velke/%Y/', null = True, blank = True, | ||||
|             help_text = 'Vlož fotografii organizátora o libovoné velikosti') | ||||
|             help_text = 'Vlož fotografii organizátora o libovolné velikosti') | ||||
|     foto_male = models.ImageField(upload_to='image_organizatori/male/%Y/', | ||||
|             null = True, blank = True, editable = False) | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,6 +1,4 @@ | |||
| {% extends "base.html" %} | ||||
| 
 | ||||
| {% block submenu %} | ||||
|   {% include "seminar/archiv/submenu.html" %} | ||||
| {% endblock %} | ||||
| {% block menu_archiv %}selected{% endblock %} | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										8
									
								
								seminar/templates/seminar/archiv/base_cisla.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								seminar/templates/seminar/archiv/base_cisla.html
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| {% extends "seminar/archiv/base.html" %} | ||||
| 
 | ||||
| {% block submenu %} | ||||
|   {% with "cisla" as selected %} | ||||
|   {% include "seminar/archiv/submenu.html" %} | ||||
|   {% endwith %} | ||||
| {% endblock %} | ||||
| 
 | ||||
							
								
								
									
										8
									
								
								seminar/templates/seminar/archiv/base_temata.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								seminar/templates/seminar/archiv/base_temata.html
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,8 @@ | |||
| {% extends "seminar/archiv/base.html" %} | ||||
| 
 | ||||
| {% block submenu %} | ||||
|   {% with "temata" as selected %} | ||||
|   {% include "seminar/archiv/submenu.html" %} | ||||
|   {% endwith %} | ||||
| {% endblock %} | ||||
| 
 | ||||
							
								
								
									
										10
									
								
								seminar/templates/seminar/archiv/base_ulohy.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								seminar/templates/seminar/archiv/base_ulohy.html
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| {% extends "seminar/archiv/base.html" %} | ||||
| 
 | ||||
| {% block menu_archiv %}selected{% endblock %} | ||||
| 
 | ||||
| {% block submenu %} | ||||
|   {% with "ulohy" as selected %} | ||||
|   {% include "seminar/archiv/submenu.html" %} | ||||
|   {% endwith %} | ||||
| {% endblock %} | ||||
| 
 | ||||
|  | @ -1,12 +1,12 @@ | |||
| {% extends "seminar/archiv/base.html" %} | ||||
| 
 | ||||
| {% block submenu %} | ||||
|   {% include "seminar/archiv/submenu.html" %} | ||||
| {% endblock %} | ||||
| {% extends "seminar/archiv/base_cisla.html" %} | ||||
| 
 | ||||
| {% block content %} | ||||
| <div> | ||||
|   <h2>{% block nadpis1 %}Archiv čísel {% endblock %}</h2> | ||||
|   <h2> | ||||
|     {% block nadpis1a %}{% block nadpis1b %} | ||||
|       Archiv čísel | ||||
|     {% endblock %}{% endblock %} | ||||
|   </h2> | ||||
| 
 | ||||
|   <ul> | ||||
|     {% for r in object_list %} | ||||
|  |  | |||
|  | @ -1,22 +1,26 @@ | |||
| {% extends "seminar/archiv/base.html" %} | ||||
| {% extends "seminar/archiv/base_cisla.html" %} | ||||
| 
 | ||||
| {% block content %} | ||||
| <div> | ||||
|   <h2>{% block nadpis1 %}Číslo {{ cislo }}{% endblock%}</h2> | ||||
|   <h2> | ||||
|     {% block nadpis1a %}{% block nadpis1b %} | ||||
|       Číslo {{ cislo }} | ||||
|     {% endblock %}{% endblock %} | ||||
|   </h2> | ||||
| 
 | ||||
|   <p><a href='{{ cislo.rocnik.verejne_url }}'>Ročník {{ cislo.rocnik }}</a> | ||||
| 
 | ||||
|   <h3>Zadané problémy</h3> | ||||
|   <ul> | ||||
|   {% for p in v_cisle_zadane %} | ||||
|     <li><a href='{{ p.verejne_url }}'>{{ p.kod_v_rocniku }} {{ p.nazev }} ({{ p.body }}b)</a> | ||||
|     <li><a href='{{ p.verejne_url }}'>{{ p.kod_v_rocniku }} {{ p.nazev }} {{ p.body_v_zavorce }}</a> | ||||
|   {% endfor %} | ||||
|   </ul> | ||||
| 
 | ||||
|   <h3>Řešené problémy</h3> | ||||
|   <ul> | ||||
|   {% for p in resene_problemy %} | ||||
|     <li><a href='{{ p.verejne_url }}'>{{ p.kod_v_rocniku }} {{ p.nazev }} ({{ p.body }}b)</a> | ||||
|     <li><a href='{{ p.verejne_url }}'>{{ p.kod_v_rocniku }} {{ p.nazev }} {{ p.body_v_zavorce }}</a> | ||||
|   {% endfor %} | ||||
|   </ul> | ||||
| 
 | ||||
|  | @ -32,19 +36,23 @@ | |||
|       <th class='border-r'># | ||||
|       <th class='border-r'>Jméno | ||||
|       {% for p in problemy %} | ||||
|       <th class='border-r'><a href="{{ p.verejne_url }}">{{ p.cislo_zadani.cislo }}.{{ p.kod }}</a> | ||||
|       <th class='border-r'><a href="{{ p.verejne_url }}">{{ p.kod_v_rocniku }}</a> | ||||
|       {% endfor %} | ||||
|       <th class='border-r'>Sum<sup>-1</sup> | ||||
|       <th class='border-r'>Celkem | ||||
|       <th class='border-r'>Za číslo</sup> | ||||
|       <th class='border-r'>Za ročník | ||||
|       <th class='border-r'>Odjakživa | ||||
|   {% for rv in vysledkovka %} | ||||
|     <tr> | ||||
|       <td class='border-r'>{{ rv.poradi }} | ||||
| 		  <th class='border-r'> {{ rv.titul }} <sup>MM</sup> {{ rv.resitel.plne_jmeno }} | ||||
|       {% for b in rv.body %} | ||||
|       <td class='border-r'>{% autoescape off %}{{ rv.poradi }}{% endautoescape %} | ||||
| 		  <th class='border-r'> | ||||
|           {% if rv.titul %} | ||||
|             {{ rv.titul }}<sup>MM</sup> | ||||
|           {% endif %} | ||||
|           {{ rv.resitel.plne_jmeno }} | ||||
|       {% for b in rv.body_ulohy %} | ||||
|       <td class='border-r'>{{ b }} | ||||
|       {% endfor %} | ||||
|       <td class='border-r'>{{ rv.body_minule }} | ||||
|       <td class='border-r'>{{ rv.body_cislo }} | ||||
|       <td class='border-r'><b>{{ rv.body_celkem_rocnik }}</b> | ||||
|       <td class='border-r'>{{ rv.body_celkem_odjakziva }} | ||||
|     </tr> | ||||
|  |  | |||
|  | @ -1,11 +1,15 @@ | |||
| {% extends "seminar/archiv/base.html" %} | ||||
| {% extends "seminar/archiv/base_ulohy.html" %} | ||||
| 
 | ||||
| {% load comments %} | ||||
| 
 | ||||
| {% block content %} | ||||
| <div> | ||||
|   {% if problem.cislo_zadani %} | ||||
|     <h2>{% block nadpis1 %}Problém {{ problem.kod_v_rocniku }}: {{ problem.nazev }}{% endblock %}</h2> | ||||
|     <h2> | ||||
|       {% 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 problem.cislo_reseni %} | ||||
|  |  | |||
|  | @ -1,8 +1,12 @@ | |||
| {% extends "seminar/archiv/base.html" %} | ||||
| {% extends "seminar/archiv/base_cisla.html" %} | ||||
| 
 | ||||
| {% block content %} | ||||
| <div> | ||||
|   <h2>{% block nadpis1 %} Ročník {{ rocnik.roman }} {% endblock %}</h2> | ||||
|   <h2> | ||||
|     {% block nadpis1a %}{% block nadpis1b %} | ||||
|       Ročník {{ rocnik.roman }} | ||||
|     {% endblock %}{% endblock %} | ||||
|   </h2> | ||||
| 
 | ||||
|   <p>Ročník číslo {{ rocnik.rocnik }} ({{ rocnik.prvni_rok }}/{{ rocnik.druhy_rok }}) | ||||
| 
 | ||||
|  | @ -12,6 +16,15 @@ | |||
|   {% endfor %} | ||||
|   </ul> | ||||
| 
 | ||||
|   {% if temata_v_rocniku %} | ||||
|     <h3>Témata</h3> | ||||
|     <ul> | ||||
|     {% for tema in temata_v_rocniku %} | ||||
|       <li><a href="{{ tema.verejne_url }}">{{ tema.kod_v_rocniku }}: {{ tema.nazev }}</a> | ||||
|     {% endfor %} | ||||
|     </ul> | ||||
|   {% endif %} | ||||
| 
 | ||||
|   {% if vysledkovka %} | ||||
|     <h3>Výsledkovka</h3> | ||||
|     <table class='vysledkovka'> | ||||
|  | @ -30,11 +43,15 @@ | |||
| 
 | ||||
|     {% for rv in vysledkovka %} | ||||
|       <tr> | ||||
|         <td class='border-r'>{{ rv.poradi }} | ||||
|         <th class='border-r'> {{ rv.resitel.titul }} <sup>MM</sup> {{ rv.resitel.plne_jmeno }} | ||||
|         <td class='border-r'>{% autoescape off %}{{ rv.poradi }}{% endautoescape %} | ||||
|         <th class='border-r'> | ||||
|           {% if rv.titul %} | ||||
|             {{ rv.titul }}<sup>MM</sup> | ||||
|           {% endif %} | ||||
|           {{ rv.resitel.plne_jmeno }} | ||||
|         <td class='border-r'>{{ rv.resitel.rocnik }} | ||||
|         <td class='border-r'>{{ rv.body_odjakziva }} | ||||
|         {% for b in rv.body %} | ||||
|         {% for b in rv.body_cisla %} | ||||
|         <td class='border-r'>{{ b }} | ||||
|         {% endfor %} | ||||
|         <td class='border-r'><b>{{ rv.body_rocnik }}</b> | ||||
|  |  | |||
|  | @ -1,9 +1,9 @@ | |||
| {% with "/archiv" as cesta %} | ||||
| 
 | ||||
| <ul> | ||||
|   <li><a href="{{cesta}}/cisla/">Čísla</a> | ||||
|   <li><a href="{{cesta}}/temata/">Témata</a> | ||||
|   <li><a href="{{cesta}}/ulohy/">Úlohy</a> | ||||
|   <li class="{% if selected == "cisla" %}selected{% endif %}"><a href="{{cesta}}/cisla/">Čísla</a> | ||||
|   <li class="{% if selected == "temata" %}selected{% endif %}"><a href="{{cesta}}/temata/">Témata</a> | ||||
|   <li class="{% if selected == "ulohy" %}selected{% endif %}"><a href="{{cesta}}/ulohy/">Úlohy</a> | ||||
| </ul> | ||||
| 
 | ||||
| {% endwith %} | ||||
|  |  | |||
							
								
								
									
										23
									
								
								seminar/templates/seminar/archiv/temata.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								seminar/templates/seminar/archiv/temata.html
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| {% extends "seminar/archiv/base_temata.html" %} | ||||
| 
 | ||||
| {% block content %} | ||||
|   <h2> | ||||
|     {% block nadpis1a %}{% block nadpis1b %} | ||||
|       Archiv témat  | ||||
|     {% endblock %}{% endblock%} | ||||
|   </h2> | ||||
| 
 | ||||
|   {% for tema in object_list %} | ||||
|   {% with tema.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="{{ tema.verejne_url }}">{{ tema.kod_v_rocniku }}: {{ tema.nazev }}</a> | ||||
|   {% endwith %} | ||||
|   {% endfor %} | ||||
|   </ul> | ||||
| 
 | ||||
| {% endblock content %} | ||||
|  | @ -1,5 +1,7 @@ | |||
| {% extends "base.html" %} | ||||
| 
 | ||||
| {% block menu_clanky %}selected{% endblock %} | ||||
| 
 | ||||
| {% block submenu %} | ||||
|   {% include "seminar/clanky/submenu.html" %} | ||||
| {% endblock %} | ||||
|  |  | |||
|  | @ -1,9 +1,9 @@ | |||
| {% with "/clanky" as cesta %} | ||||
| 
 | ||||
| <ul> | ||||
|   <li><a href="{{cesta}}/uvod/">Úvod</a> | ||||
|   <li><a href="{{cesta}}/org/">Organizátorské články</a> | ||||
|   <li><a href="{{cesta}}/resitel/">Řešitelské články</a> | ||||
|   <li class="{% if selected == "uvod" %}selected{% endif %}"><a href="{{cesta}}/uvod/">Úvod</a> | ||||
|   <li class="{% if selected == "org" %}selected{% endif %}"><a href="{{cesta}}/org/">Organizátorské články</a> | ||||
|   <li class="{% if selected == "resitel" %}selected{% endif %}"><a href="{{cesta}}/resitel/">Řešitelské články</a> | ||||
| </ul> | ||||
| 
 | ||||
| {% endwith %} | ||||
|  |  | |||
|  | @ -1,22 +1,25 @@ | |||
| {% extends "seminar/cojemam/base.html" %} | ||||
| {% block nadpis1 %} | ||||
| {% block nadpis1a %}{% block nadpis1b %} | ||||
|   {% if aktivni %} | ||||
|     Organizátoři | ||||
|   {% else %} | ||||
|     Vysloužilí organizátoři | ||||
|   {% endif %} | ||||
| {% endblock%} | ||||
| {% endblock%}{% endblock%} | ||||
| 
 | ||||
| {% block menu_uvod %}selected{% endblock %} | ||||
| {% block submenu %} | ||||
|   {% with "org" as selected %} | ||||
|   {% include "seminar/cojemam/submenu.html" %} | ||||
|   {% endwith %} | ||||
| {% endblock %} | ||||
| 
 | ||||
| {% block content %} | ||||
| <div> | ||||
|   {% if not aktivni %} | ||||
|     <a href="/co-je-MaM/organizatori/">Aktivní organizátoři</a> | ||||
|   {% endif %} | ||||
|   {% for org in object_list %} | ||||
|     <!-- | ||||
|     {% if org.user.is_active %} | ||||
|       <b>Aktivní</b> | ||||
|     {% else %} | ||||
|       Není aktivní | ||||
|     {% endif %} | ||||
|     --> | ||||
|     <h2> | ||||
|     {{org.user.first_name}} | ||||
|     {% if org.prezdivka %} | ||||
|  | @ -31,13 +34,13 @@ | |||
|     </div> | ||||
|     {% endif %} | ||||
|     <ul> | ||||
|       {#TODO časovat dle rodu #} | ||||
|       {% if org.organizuje_od_roku %} | ||||
|         <li>{% if aktivni %}Organizuje{% else %}Organizoval{% endif %} od roku {{org.organizuje_od_roku}} | ||||
|       {% endif %} | ||||
|       {% if org.organizuje_do_roku %} | ||||
|         <li>{% if aktivni %}Organizuje{% else %}Organizoval{% endif %} do roku {{org.organizuje_do_roku}} | ||||
|       {% endif %} | ||||
|         <li> | ||||
|           {% if aktivni %} | ||||
|             Organizuje od roku {{org.organizuje_od_roku}} | ||||
|           {% else %} | ||||
|             {#TODO časovat dle rodu #} | ||||
|             Organizoval v letech {{org.organizuje_od_roku}}–{{org.organizuje_do_roku}} | ||||
|           {% endif %} | ||||
|       {% if org.studuje %} | ||||
|         <li>Studuje: {{org.studuje}} | ||||
|       {% endif %} | ||||
|  | @ -53,6 +56,8 @@ | |||
| 
 | ||||
|   {% if aktivni%} | ||||
|     <a href="organizovali/">Vysloužilí organizátoři</a> | ||||
|   {% else %} | ||||
|     <a href="/co-je-MaM/organizatori/">Aktivní organizátoři</a> | ||||
|   {% endif %} | ||||
| 
 | ||||
| </div> | ||||
|  |  | |||
|  | @ -1,10 +1,10 @@ | |||
| {% with "/co-je-MaM" as cesta %} | ||||
| 
 | ||||
| <ul> | ||||
|   <li><a href="{{cesta}}/uvod/">Úvod</a> | ||||
|   <li><a href="{{cesta}}/jak-resit/">Jak řešit</a> | ||||
|   <li><a href="{{cesta}}/organizatori/">Organizátoři</a> | ||||
|   <li><a href="{{cesta}}/FAQ/">FAQ</a> | ||||
|   <li class="{% if selected == "uvod" %}selected{% endif %}"><a href="{{cesta}}/uvod/">Úvod</a> | ||||
|   <li class="{% if selected == "jak-resit" %}selected{% endif %}"><a href="{{cesta}}/jak-resit/">Jak řešit</a> | ||||
|   <li class="{% if selected == "org" %}selected{% endif %}"><a href="{{cesta}}/organizatori/">Organizátoři</a> | ||||
|   <li class="{% if selected == "FAQ" %}selected{% endif %}"><a href="{{cesta}}/FAQ/">FAQ</a> | ||||
| </ul> | ||||
| 
 | ||||
| {% endwith %} | ||||
|  |  | |||
|  | @ -1,15 +1,32 @@ | |||
| {% extends 'base.html' %} | ||||
| Před začátkem bloku. | ||||
| {% block body %} | ||||
| Tady bude začátek. | ||||
| 	{% for novinka in novinky %} | ||||
| 		{% if novinka.datum > pred_2_mesici and novinka.zverejneno %} | ||||
| 			<p> | ||||
| 			Tady bude novinka. | ||||
| 			{{ novinka.text }} | ||||
| 			</p> | ||||
| 			<img src='{{ novinka.obrazek }}'> | ||||
| 		{% endif %} | ||||
| 	{% endfor%} | ||||
| Tady bude konec. | ||||
| {% endblock %} | ||||
| {% for novinka in object_list %} | ||||
| {# pripravene div-y na stylovani#} | ||||
| <div> | ||||
|   {# datum #} | ||||
|   <div><b>{{novinka.datum}}</b></div> | ||||
|   {# text #} | ||||
|   {{ novinka.text | safe }} | ||||
|   {# obrazek #} | ||||
|   {% if novinka.obrazek %} | ||||
|     <div> | ||||
|       <img src='{{novinka.obrazek.url}}' | ||||
|       height=' | ||||
|       {% if novinka.obrazek.height > 200 %} {# vyska obrazku natvrdo #} | ||||
|         200 | ||||
|       {% else %} | ||||
|         {{novinka.obrazek.height}} | ||||
|       {% endif%} | ||||
|       '> | ||||
|     </div> | ||||
|   {% endif %} | ||||
|   {# autor #} | ||||
|   {% if user.is_staff %} | ||||
|     <div>{{novinka.autor.first_name}} | ||||
|       {% if novinka.autor.organizator.prezdivka%} | ||||
|         „{{novinka.autor.organizator.prezdivka}}“ | ||||
|       {% endif %} | ||||
|       {{novinka.autor.last_name}} | ||||
|     </div> | ||||
|   {% endif %} | ||||
| </div> | ||||
| {% endfor%} | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,7 +1,12 @@ | |||
| {% load staticfiles %} | ||||
| 
 | ||||
| {% block content %} | ||||
|   <h2>{% block nadpis1 %}Tady se pracuje{% endblock%}</h2> | ||||
|   <h2> | ||||
|     {% block nadpis1a %}{% block nadpis1b %} | ||||
|       Tady se pracuje | ||||
|     {% endblock %}{% endblock %} | ||||
|   </h2> | ||||
| 
 | ||||
|   <p> | ||||
|     Na této stránce velmi intenzivně pracujeme. | ||||
|     Za dočasnou nedostupnost se omlouváme. | ||||
|  |  | |||
|  | @ -1,8 +1,19 @@ | |||
| {% extends "seminar/soustredeni/base.html" %} | ||||
| 
 | ||||
| {% block menu_soustredeni %}selected{% endblock %} | ||||
| {% block submenu %} | ||||
|   {% with "probehlo" as selected %} | ||||
|   {% include "seminar/soustredeni/submenu.html" %} | ||||
|   {% endwith %} | ||||
| {% endblock submenu %} | ||||
| 
 | ||||
| {% block content %}{% if user.is_authenticated %}{# PRACUJE SE STRANKA #} | ||||
| 
 | ||||
|   <h1>{% block nadpis1 %}Soustředění{% endblock %}</h1> | ||||
|   <h2> | ||||
|     {% block nadpis1a %}{% block nadpis1b %} | ||||
|       Soustředění | ||||
|     {% endblock %}{% endblock %} | ||||
|   </h2> | ||||
| 
 | ||||
|   {# Projdi vsechna soustredeni #} | ||||
|   {% for soustredeni in object_list %} | ||||
|  |  | |||
|  | @ -1,9 +1,9 @@ | |||
| {% with "/soustredeni" as cesta %} | ||||
| 
 | ||||
| <ul> | ||||
|   <li><a href="{{cesta}}/uvod/">Úvod</a> | ||||
|   <li><a href="{{cesta}}/pripravujeme/">Připravujeme</a> | ||||
|   <li><a href="{{cesta}}/probehlo/">Proběhlo</a> | ||||
|   <li class="{% if selected == "uvod" %}selected{% endif %}"><a href="{{cesta}}/">Úvod</a> | ||||
|   <li class="{% if selected == "pripravujeme" %}selected{% endif %}"><a href="{{cesta}}/pripravujeme/">Připravujeme</a> | ||||
|   <li class="{% if selected == "probehlo" %}selected{% endif %}"><a href="{{cesta}}/probehlo/">Proběhlo</a> | ||||
| </ul> | ||||
| 
 | ||||
| {% endwith %} | ||||
|  |  | |||
							
								
								
									
										13
									
								
								seminar/templates/seminar/stare_novinky.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								seminar/templates/seminar/stare_novinky.html
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | |||
| {% extends 'base.html' %} | ||||
| 
 | ||||
| {% block content %} | ||||
| 
 | ||||
|   <h2> | ||||
|     {% block nadpis1a %}{% block nadpis1b %} | ||||
|     Archiv novinek | ||||
|     {% endblock %}{% endblock %} | ||||
|   </h2> | ||||
| 
 | ||||
|   {% include 'seminar/novinky.html' %} | ||||
| 
 | ||||
| {% endblock %} | ||||
|  | @ -2,7 +2,11 @@ | |||
| 
 | ||||
| {% block content %} | ||||
| <div> | ||||
|   <h2>{% block nadpis1 %}Stav databáze{% endblock %}</h2> | ||||
|   <h2> | ||||
|     {% block nadpis1a %}{% block nadpis1b %} | ||||
|       Stav databáze | ||||
|     {% endblock %}{% endblock %} | ||||
|   </h2> | ||||
| 
 | ||||
|   <h3>Řešitelé</h3> | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,8 +1,20 @@ | |||
| Trala! | ||||
| {% extends 'base.html' %} | ||||
| 
 | ||||
| HU! | ||||
| {% block novinky %} | ||||
| 	Tady bude nadpis pro novinky. | ||||
| 	{% include 'novinky.html' %} | ||||
| 
 | ||||
| {% block content %} | ||||
| 
 | ||||
|   {# Uvitaci text #} | ||||
|   <h2> | ||||
|     {% block nadpis1a %}{% block nadpis1b %} | ||||
|       Tož vitajte! | ||||
|     {% endblock %}{% endblock %} | ||||
|   </h2> | ||||
|   <p> Uvítací text či-co.</p> | ||||
| 
 | ||||
|   {# Novinky #} | ||||
|   <h2>Novinky</h2> | ||||
|   {% include 'seminar/novinky.html' %} | ||||
| 
 | ||||
|   <a href='/stare-novinky/'>Archiv novinek</a> | ||||
|     | ||||
| {% endblock %} | ||||
|  |  | |||
|  | @ -1,8 +1,19 @@ | |||
| {% extends "seminar/zadani/base.html" %} | ||||
| 
 | ||||
| {% block submenu %} | ||||
|   {% with "aktualni" as selected %} | ||||
|   {% include 'seminar/zadani/submenu.html' %} | ||||
|   {% endwith %} | ||||
| {% endblock submenu %} | ||||
| 
 | ||||
| {% block content %} | ||||
| <div> | ||||
|   <h2>{% block nadpis1 %}Aktuální zadání{% endblock %}</h2> | ||||
|   <h2> | ||||
|     {% block nadpis1a %}{% block nadpis1b %} | ||||
|       Aktuální zadání | ||||
|     {% endblock %}{% endblock %} | ||||
|   </h2> | ||||
|    | ||||
|   {% with nastaveni.aktualni_cislo as ac %} | ||||
| 
 | ||||
|       {% if ac.zadane_problemy.all %} | ||||
|  | @ -18,9 +29,7 @@ | |||
|       {# publikace jednotlivych zadani #} | ||||
|       {% for problem in sada %} | ||||
|         {# TODO použít {{problem.kod_v_rocniku}} ? vrací 4.u1 místo 4.1 #} | ||||
|         <h4>{{problem.cislo_zadani.cislo}}.{{problem.kod}} {{problem.nazev}} | ||||
|           {# nezobrazuj body, pokud nejsou zadane #} | ||||
|           {% if problem.body %}({{problem.body}}b){% endif %}</h4> | ||||
|         <h4>{{problem.cislo_zadani.cislo}}.{{problem.kod}} {{problem.nazev}} {{ problem.body_v_zavorce }}</h4> | ||||
|         {% autoescape off %}{{problem.text_zadani}}{% endautoescape %} | ||||
|         <hr> | ||||
|       {% endfor %} | ||||
|  | @ -28,12 +37,7 @@ | |||
|       Aktuálně nejsou zadané žádné úlohy k řešení. | ||||
|     {% endfor %} | ||||
| 
 | ||||
|     <h3>Témata</h3> | ||||
|     {% for tema in temata %} | ||||
|       <h4>Téma {{tema.kod}}: {{tema.nazev}}</h4> | ||||
|       <a href=""><span style="color:red">Stránka tématu</span></a> | ||||
|       {% autoescape off %}{{tema.text_zadani}}{% endautoescape %} | ||||
|     {% endfor %} | ||||
|     <a href="/zadani/temata/"><h3>Témata</h3></a> | ||||
| 
 | ||||
|   {% endwith %} | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,26 +1,38 @@ | |||
| {% extends "seminar/zadani/base.html" %} | ||||
| 
 | ||||
| {% block submenu %} | ||||
|   {% with "temata" as selected %} | ||||
|   {% include 'seminar/zadani/submenu.html' %} | ||||
|   {% endwith %} | ||||
| {% endblock submenu %} | ||||
| 
 | ||||
| 
 | ||||
| {% block content %} | ||||
| {% with nastaveni.aktualni_rocnik as ar %} | ||||
| <div> | ||||
|   <h2>{% block nadpis1 %}Témata{% endblock %}</h2> | ||||
|   <h2> | ||||
|     {% block nadpis1a %}{% block nadpis1b %} | ||||
|       Témata | ||||
|     {% endblock %}{% endblock %} | ||||
|   </h2> | ||||
| 
 | ||||
|   <p> | ||||
|     Témata obvykle představují složitější problémy, než samostatné úlohy. Navíc | ||||
|     v jejich zadání je vždy prostor pro tvůrčí rozšíření. Nad nápady | ||||
|     k tématům můžeš přemýšlet celý rok až do termínu odeslání šestého | ||||
|     čísla. Pokud tě něco napadne, napiš nám o tom článek. My došlé články | ||||
|     revidujeme, hodnotíme a ty nejzajímavější uveřejňujeme zde na webu, | ||||
|     případně i v někerém z čísel časopisu. Můžeš také reagovat na | ||||
|     články ostatních řešitelů. Za pěkný článek k tématu lze získat třeba i | ||||
|     20 bodů, určitě se tedy vyplatí jimi zabývat. Pokud nevíš, jak takový | ||||
|     článek napsat, podívej se na náš <span style="color:red">návod</span>.{# TODO odkaz #} | ||||
|     Témata jsou hlavním obsahem časopisu M&M. Obvykle představují | ||||
|     složitější a obecnější problémy než samostatné úlohy. Navíc je v jejich | ||||
|     zadání vždy prostor pro tvůrčí rozšíření. Za pěkný článek k tématu lze | ||||
|     získat třeba i 20 bodů, určitě se tedy vyplatí se tématy zabývat. | ||||
|   </p> | ||||
|   <p> | ||||
|     <a href="/co-je-MaM/jak-resit/">Jak řešit téma?</a> | ||||
|   </p> | ||||
|   {% if temata %} | ||||
|   <p> | ||||
|     Letos jsme pro tebe připravili tato témata: | ||||
|   </p> | ||||
|   {% endif %} | ||||
|   {% for problem in temata %} | ||||
|     {# TODO použít {{problem.kod_v_rocniku}} ? vrací t4 místo 4 #} | ||||
|     <h3>Téma {{problem.kod}}: {{problem.nazev}}</h3> | ||||
|     <a href="{{problem.verejne_url}}"><h3>Téma {{problem.kod}}: {{problem.nazev}}</h3></a> | ||||
|     {% autoescape off %}{{problem.text_zadani}}{% endautoescape %} | ||||
|     <hr> | ||||
|   {% empty %} | ||||
|  |  | |||
|  | @ -1,5 +1,7 @@ | |||
| {% extends "base.html" %} | ||||
| 
 | ||||
| {% block menu_zadani %}selected{% endblock %} | ||||
| 
 | ||||
| {% block submenu %} | ||||
|   {% include 'seminar/zadani/submenu.html' %} | ||||
| {% endblock submenu %} | ||||
|  |  | |||
|  | @ -1,11 +1,11 @@ | |||
| {% with "/zadani" as cesta %} | ||||
| 
 | ||||
| <ul> | ||||
|   <li><a href="{{cesta}}/aktualni/">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}}/vysledkove-listiny/">Výsledkové listiny</a> | ||||
|   <li class="{% if selected == "aktualni" %}selected{% endif %}"><a href="{{cesta}}/aktualni/">Aktuální zadání</a> | ||||
|   <li class="{% if selected == "ulohy" %}selected{% endif %}"><a href="{{cesta}}/ulohy/">Úlohy</a> | ||||
|   <li class="{% if selected == "temata" %}selected{% endif %}"><a href="{{cesta}}/temata/">Témata</a> | ||||
|   <li class="{% if selected == "aktualni-cislo" %}selected{% endif %}"><a href="{{cesta}}/aktualni-cislo/">Aktuální číslo</a> | ||||
|   <li class="{% if selected == "vysledkove-listiny" %}selected{% endif %}"><a href="{{cesta}}/vysledkove-listiny/">Výsledkové listiny</a> | ||||
| </ul> | ||||
| 
 | ||||
| {% endwith %} | ||||
|  |  | |||
|  | @ -7,18 +7,20 @@ urlpatterns = patterns('', | |||
|     url(r'^co-je-MaM/organizatori/organizovali/$', views.CojemamOrganizatoriStariView.as_view(), name='stari_organizatori'), | ||||
| 
 | ||||
|     url(r'^archiv/cisla/$', views.CislaView.as_view()), | ||||
|     url(r'^archiv/temata/$', views.ArchivTemataView.as_view()), | ||||
| 
 | ||||
|     url(r'^rocnik/(?P<rocnik>\d+)/$', views.RocnikView.as_view(), name='seminar_rocnik'), | ||||
|     url(r'^cislo/(?P<rocnik>\d+)\.(?P<cislo>[0-9-]+)/$', 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(), | ||||
|     url(r'^soustredeni/probehlo/$', views.SoustredeniListView.as_view(), | ||||
|         name = 'seminar_seznam_soustredeni'), | ||||
|     url(r'^soustredeni/(?P<pk>\d+)/$', views.SoustredeniView.as_view(), name='seminar_soustredeni'), | ||||
| 
 | ||||
|     url(r'^zadani/aktualni/$', views.AktualniZadaniView, name='seminar_aktualni_zadani'), | ||||
|     url(r'^zadani/temata/$', views.TemataView, name='seminar_temata'), | ||||
|     url(r'^zadani/temata/$', views.ZadaniTemataView, name='seminar_temata'), | ||||
|     url(r'^$', views.TitulniStranaView.as_view(), name='titulni_strana'), | ||||
|     url(r'^stare-novinky/$', views.StareNovinkyView.as_view(), name='stare_novinky'), | ||||
| 
 | ||||
|     url(r'^stav$', views.StavDatabazeView, name='stav_databaze'), | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										202
									
								
								seminar/views.py
									
									
									
									
									
								
							
							
						
						
									
										202
									
								
								seminar/views.py
									
									
									
									
									
								
							|  | @ -11,15 +11,16 @@ from .models import Problem, Cislo, Reseni, Nastaveni, Rocnik, Soustredeni, Orga | |||
| from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva | ||||
| from . import utils | ||||
| 
 | ||||
| import datetime | ||||
| from datetime import timedelta, date | ||||
| from itertools import groupby | ||||
| 
 | ||||
| 
 | ||||
| def AktualniZadaniView(request): | ||||
|     nastaveni = get_object_or_404(Nastaveni) | ||||
|     problemy = Problem.objects.filter(cislo_zadani=nastaveni.aktualni_cislo).filter(stav = 'zadany') | ||||
|     ulohy = problemy.filter(typ = 'uloha') | ||||
|     serialy = problemy.filter(typ = 'serial') | ||||
|     temata = problemy.filter(typ = 'tema') | ||||
|     ulohy = problemy.filter(typ = 'uloha').order_by('kod') | ||||
|     serialy = problemy.filter(typ = 'serial').order_by('kod') | ||||
|     temata = problemy.filter(typ = 'tema').order_by('kod') | ||||
|     jednorazove_problemy = [ulohy, serialy] | ||||
|     return render(request, 'seminar/zadani/AktualniZadani.html', | ||||
|             {'nastaveni': nastaveni, | ||||
|  | @ -28,11 +29,11 @@ def AktualniZadaniView(request): | |||
|                 }, | ||||
|             ) | ||||
| 
 | ||||
| def TemataView(request): | ||||
| def ZadaniTemataView(request): | ||||
|     nastaveni = get_object_or_404(Nastaveni) | ||||
|     return render(request, 'seminar/zadani/Temata.html', | ||||
|         { | ||||
|             'temata': Problem.objects.filter(typ=Problem.TYP_TEMA, cislo_zadani__rocnik=nastaveni.aktualni_rocnik), | ||||
|             'temata': Problem.objects.filter(typ=Problem.TYP_TEMA, stav=Problem.STAV_ZADANY, cislo_zadani__rocnik=nastaveni.aktualni_rocnik).order_by('kod'), | ||||
|         } | ||||
|     ) | ||||
| 
 | ||||
|  | @ -40,19 +41,17 @@ def TemataView(request): | |||
| 
 | ||||
| class TitulniStranaView(generic.ListView): | ||||
|     model = Novinky | ||||
|     template_name='seminar/novinky.html' | ||||
|     template_name='seminar/titulnistrana.html' | ||||
|     queryset = Novinky.objects.filter(zverejneno=True).order_by('-datum')[:5] | ||||
| 
 | ||||
|     def get_context_data(self, **kwargs): | ||||
|         context = super(TitulniStranaView, self).get_context_data(**kwargs) | ||||
|         context['pred_2_mesici'] = (datetime.date.today() - datetime.timedelta(2*365/12)).isoformat() | ||||
|         #ulozi datum pred dvema mesici | ||||
|         #elegantneji mozne pomoci dateutil: | ||||
|         ''' | ||||
|         from dateutil.relativedelta import relativedelta | ||||
|     #def get_context_data(self, **kwargs): | ||||
|     #    context = super(TitulniStranaView, self).get_context_data(**kwargs) | ||||
|     #    return context | ||||
| 
 | ||||
|         date.today() + relativedelta(month=-2) | ||||
|         ''' | ||||
|         return context | ||||
| class StareNovinkyView(generic.ListView): | ||||
|     model = Novinky | ||||
|     template_name = 'seminar/stare_novinky.html' | ||||
|     queryset = Novinky.objects.filter(zverejneno=True).order_by('-datum') | ||||
| 
 | ||||
| ### Co je M&M | ||||
| 
 | ||||
|  | @ -61,7 +60,7 @@ class TitulniStranaView(generic.ListView): | |||
| class CojemamOrganizatoriView(generic.ListView): | ||||
|     model = Organizator | ||||
|     template_name='seminar/cojemam/organizatori.html' | ||||
|     queryset = Organizator.objects.filter(user__is_active=True).order_by('user__first_name') | ||||
|     queryset = Organizator.objects.exclude(organizuje_do_roku__isnull=False, organizuje_do_roku__lt=date.today().year).order_by('user__first_name') | ||||
|     def get_context_data(self, **kwargs): | ||||
|         context = super(CojemamOrganizatoriView, self).get_context_data(**kwargs) | ||||
|         context['aktivni'] = True | ||||
|  | @ -70,7 +69,7 @@ class CojemamOrganizatoriView(generic.ListView): | |||
| class CojemamOrganizatoriStariView(generic.ListView): | ||||
|     model = Organizator | ||||
|     template_name='seminar/cojemam/organizatori.html' | ||||
|     queryset = Organizator.objects.filter(user__is_active=False) | ||||
|     queryset = Organizator.objects.filter(organizuje_do_roku__isnull=False, organizuje_do_roku__lt=date.today().year).order_by('-organizuje_do_roku') | ||||
| 
 | ||||
| ### Archiv | ||||
| 
 | ||||
|  | @ -78,6 +77,26 @@ class CislaView(generic.ListView): | |||
|     model = Rocnik | ||||
|     template_name='seminar/archiv/cisla.html' | ||||
| 
 | ||||
| 
 | ||||
| def sloupec_s_poradim(vysledky): | ||||
|     # počet řešitelů ve výsledkovce nad aktuálním | ||||
|     lepsich_resitelu = 0 | ||||
| 
 | ||||
|     poradi_l = [] | ||||
|     # projdeme skupiny řešitelů se stejným počtem bodů | ||||
|     for skupina in (list(x) for _, x in groupby(vysledky, lambda x: x.body)): | ||||
| 
 | ||||
|         # připravíme si obsahy buněk ve sloupci pořadí pro skupinu | ||||
|         if len(skupina) == 1: | ||||
|             poradi_l += ["{}.".format(lepsich_resitelu + 1)] | ||||
|         # je-li účastníků se stejným počtem bodů víc, pořadí (rozsah X.-Y.) je jen u prvního | ||||
|         else: | ||||
|             poradi_l += ["{}.–{}.".format(lepsich_resitelu + 1, lepsich_resitelu + len(skupina))] + [""] * (len(skupina)-1) | ||||
|         lepsich_resitelu += len(skupina) | ||||
| 
 | ||||
|     return poradi_l | ||||
| 
 | ||||
| 
 | ||||
| class RocnikView(generic.DetailView): | ||||
|     model = Rocnik | ||||
|     template_name = 'seminar/archiv/rocnik.html' | ||||
|  | @ -99,73 +118,45 @@ class RocnikView(generic.DetailView): | |||
|     def get_context_data(self, **kwargs): | ||||
|         context = super(RocnikView, self).get_context_data(**kwargs) | ||||
| 
 | ||||
|         cisla_v_rocniku = VysledkyKCisluZaRocnik.objects.filter(cislo__verejna_vysledkovka = True).filter(cislo__rocnik = context['rocnik']).order_by('-cislo') | ||||
|         cisla_v_rocniku = VysledkyKCisluZaRocnik.objects.filter(cislo__verejna_vysledkovka = True).filter(cislo__rocnik = context['rocnik']).order_by('cislo') | ||||
|         #vyberu vsechny verejne vysledky z rocniku | ||||
|         #pokud žádné nejsou, výsledkovka se nezobrazí | ||||
|         if cisla_v_rocniku: | ||||
|             vysledky = cisla_v_rocniku.filter(cislo = cisla_v_rocniku[0].cislo).order_by('-body', 'resitel__prijmeni', 'resitel__jmeno').select_related('resitel') | ||||
|             vysledky = list(cisla_v_rocniku.filter(cislo = cisla_v_rocniku[0].cislo).order_by('-body', 'resitel__prijmeni', 'resitel__jmeno').select_related('resitel')) | ||||
|             #vybere vsechny vysledky z posledniho verejneho cisla a setridi sestupne dle bodu | ||||
|             vysledky_resitele = {} | ||||
|             stejne_body = {} | ||||
|             konec_rozmezi = {} | ||||
|             vysledkovka = [] | ||||
|             posledni_body = 100000 | ||||
|             predchozi_poradi = None | ||||
|             body_minule = None | ||||
| 
 | ||||
|             for vi in range(len(vysledky)): | ||||
|                 v = vysledky[vi] | ||||
|                 rv = RadekVysledkovky() | ||||
|                 rv.resitel = v.resitel   | ||||
|             # doplníme některé údaje do řádků výsledkovky pro řešitele ve skupině | ||||
|             for poradi, v in zip(sloupec_s_poradim(vysledky), vysledky): | ||||
|                 v.poradi = poradi | ||||
|                 v.resitel.rocnik = v.resitel.rocnik(context['rocnik']) | ||||
| 
 | ||||
|                 verejne_vysl_odjakziva = VysledkyKCisluOdjakziva.objects.filter(cislo__verejna_vysledkovka = True).filter(cislo__rocnik = context['rocnik']).filter(cislo = cisla_v_rocniku[0].cislo) | ||||
|                 rv.body_odjakziva = verejne_vysl_odjakziva.filter(resitel = rv.resitel)[0].body | ||||
|                 rv.resitel.titul = rv.resitel.get_titul(rv.body_odjakziva) | ||||
|                 rv.resitel.rocnik = rv.resitel.rocnik(context['rocnik']) | ||||
|                 rv.body = []*len(context['rocnik'].verejna_cisla()) | ||||
| 
 | ||||
|                 v.body_odjakziva = verejne_vysl_odjakziva.filter(resitel = v.resitel)[0].body | ||||
|                 v.titul = v.resitel.get_titul(v.body_odjakziva) | ||||
|                 v.body_rocnik = v.body | ||||
|                 v.body_cisla = [] | ||||
| 
 | ||||
|                 #pokud pro dany rok a cislo nema resitel vysledky, ma defaultne 0 | ||||
|                 for cis in context['rocnik'].verejna_cisla(): | ||||
|                     if cis.verejna_vysledkovka: | ||||
|                         print cis | ||||
|                         body_za_cislo = VysledkyZaCislo.objects.filter(cislo__rocnik = context['rocnik']).filter(cislo = cis).filter(resitel = rv.resitel) | ||||
|                         body_za_cislo = VysledkyZaCislo.objects.filter(cislo__rocnik = context['rocnik']).filter(cislo = cis).filter(resitel = v.resitel) | ||||
|                         #seznam vysledku se spravnym rocnikem a cislem pro resitele | ||||
|                         #zobrazim jen je-li vysledkovka verejna | ||||
|                         if body_za_cislo: | ||||
|                             rv.body.append(body_za_cislo[0].body) | ||||
|                             v.body_cisla.append(body_za_cislo[0].body) | ||||
|                             #neprazdne vysledky by mely obsahovat prave jeden vysledek | ||||
|                         else: | ||||
|                             rv.body.append(0) | ||||
|                             v.body_cisla.append(0) | ||||
|                             #resitel nema za cislo body | ||||
|                 rv.poradi = '' | ||||
|                 #defaultni poradi je prazdne - kvuli sdilenym mistum | ||||
|                 rv.body_rocnik = v.body | ||||
|                 rv.body_na_zacatku = rv.body_odjakziva - rv.body_rocnik | ||||
|                 #body za minule rocniky | ||||
|                 if posledni_body > v.body: | ||||
|                     if stejne_body.get(posledni_body): | ||||
|                         #pokud uz jsme predtim narazili na stejny pocet bodu | ||||
|                         konec_rozmezi[posledni_body] = int(predchozi_poradi.poradi) + stejne_body[posledni_body] | ||||
|                         #druha hranice sdilenych pozic - zacatek + pocet lidi se stejnymi body | ||||
|                         predchozi_poradi.poradi = '{0}. -- {1}.'.format(predchozi_poradi.poradi,konec_rozmezi[posledni_body]) | ||||
|                         #predchozi radek ktery menil pocty bodu bude mit rozsah, pokud bylo vice radku se stejnym poctem bodu | ||||
|                     elif predchozi_poradi : | ||||
|                         predchozi_poradi.poradi = '{0}.'.format(predchozi_poradi.poradi) | ||||
|                         #pokud nebyl rozsah hodnot, vypisu, pridam tecku za cislo | ||||
|                     posledni_body = v.body | ||||
|                     rv.poradi = vi + 1 | ||||
|                     #poradi se meni jen u resitele s rozdilnym poctem bodu nez mel minuly | ||||
|                     predchozi_poradi = rv | ||||
|                 elif posledni_body == v.body: | ||||
|                     if not stejne_body.get(v.body): | ||||
|                         stejne_body[v.body] = 1 | ||||
|                         #pokud klic neexistuje, zalozim novy pro tohoto resitele | ||||
|                     else: | ||||
|                         stejne_body[v.body] += 1 | ||||
|                         #rozsirim pocet resitelu sdilejici stejnou pozici | ||||
|                 vysledky_resitele[v.resitel.id] = rv | ||||
|                 #odkaz na radek vysledkovky patrici danemu resiteli | ||||
|                 vysledkovka.append(rv) | ||||
| 
 | ||||
|                 vysledkovka.append(v) | ||||
| 
 | ||||
|             temata_v_rocniku = Problem.objects.filter(typ=Problem.TYP_TEMA, cislo_zadani__rocnik=context['rocnik']) | ||||
| 
 | ||||
|             context['vysledkovka'] = vysledkovka | ||||
|             context['temata_v_rocniku'] = temata_v_rocniku | ||||
|         return context | ||||
| 
 | ||||
| class ProblemView(generic.DetailView): | ||||
|  | @ -194,6 +185,7 @@ class CisloView(generic.DetailView): | |||
|                           {'verbose_name': queryset.model._meta.verbose_name}) | ||||
|         return obj | ||||
| 
 | ||||
| 
 | ||||
|     def get_context_data(self, **kwargs): | ||||
|         context = super(CisloView, self).get_context_data(**kwargs) | ||||
| 
 | ||||
|  | @ -206,7 +198,7 @@ class CisloView(generic.DetailView): | |||
| 
 | ||||
|         resene_problemy = Problem.objects.filter(cislo_reseni=context['cislo']).filter(typ__in=typy_skutecne_zadanych).order_by('cislo_reseni__cislo', 'kod') | ||||
| 
 | ||||
|         problemy = sorted(list(set([r.problem for r in reseni])), key=lambda x:(0 if x.typ==Problem.TYP_ULOHA else 1,x.kod)) | ||||
|         problemy = sorted(list(set([r.problem for r in reseni])), key=lambda x:(0 if x.typ==Problem.TYP_ULOHA else 1, x.kod_v_rocniku)) | ||||
|         #setridi problemy podle typu a poradi zadani | ||||
|         problem_index = {} | ||||
|         for i in range(len(problemy)): | ||||
|  | @ -214,59 +206,30 @@ class CisloView(generic.DetailView): | |||
|             #umoznuje zjistit index podle id problemu | ||||
| 
 | ||||
|         vysledky_resitele = {} | ||||
|         stejne_body = {} | ||||
|         konec_rozmezi = {} | ||||
|         vysledkovka = [] | ||||
|         posledni_body = 100000 | ||||
|         predchozi_poradi = None | ||||
|         body_minule = None | ||||
| 
 | ||||
|         for vi in range(len(vysledky)): | ||||
|             v = vysledky[vi] | ||||
|             tv = RadekVysledkovky() | ||||
|             tv.resitel = v.resitel   | ||||
|             tv.resitel.titul = tv.resitel.get_titul(v.body) | ||||
|             tv.rocnik = tv.resitel.rocnik(context['cislo'].rocnik) | ||||
|             tv.vysledek = v | ||||
|             #odkazuje na VysledkyKCislu | ||||
|             tv.body = ['']*len(problemy) | ||||
|             #pole bodu za ulohy | ||||
|             tv.poradi = '' | ||||
|             #defaultni poradi je prazdne - kvuli sdilenym mistum | ||||
|             tv.body_celkem_rocnik = v.body | ||||
|             tv.body_celkem_odjakziva = VysledkyKCisluOdjakziva.objects.get(resitel=v.resitel, cislo=context['cislo']).body | ||||
|         # doplníme některé údaje do řádků výsledkovky pro řešitele ve skupině | ||||
|         for poradi, v in zip(sloupec_s_poradim(vysledky), vysledky): | ||||
|             v.poradi = poradi | ||||
|             v.body_celkem_rocnik = v.body | ||||
|             v.body_celkem_odjakziva = VysledkyKCisluOdjakziva.objects.get(resitel=v.resitel, cislo=context['cislo']).body | ||||
| 
 | ||||
|             # je tady '', aby se nezobrazovala 0, pokud se řešitel o řešení úlohy ani nepokusil | ||||
|             v.body_ulohy = [''] * len(problemy) | ||||
| 
 | ||||
|             v.titul = v.resitel.get_titul(v.body_celkem_odjakziva) | ||||
| 
 | ||||
|             body_cislo_q = VysledkyZaCislo.objects.filter(resitel=v.resitel, cislo=context['cislo']) | ||||
|             tv.body_cislo = body_cislo_q[0].body if len(body_cislo_q) > 0 else 0 | ||||
|             tv.body_minule = tv.body_celkem_rocnik - tv.body_cislo | ||||
|             tv.titul=tv.resitel.get_titul(int(tv.body_celkem_odjakziva)) | ||||
|             #pocet bodu do tohoto cisla | ||||
|             if posledni_body > tv.body_celkem_rocnik: | ||||
|                 if stejne_body.get(posledni_body): | ||||
|                     konec_rozmezi[posledni_body] = int(predchozi_poradi.poradi) + stejne_body[posledni_body] | ||||
|                     #druha hranice sdilenych pozic - zacatek + pocet lidi se stejnymi body | ||||
|                     predchozi_poradi.poradi = '{0}. -- {1}.'.format(predchozi_poradi.poradi,konec_rozmezi[posledni_body]) | ||||
|                     #predchozi radek ktery menil pocty bodu bude mit rozsah, pokud bylo vice radku se stejnym poctem bodu | ||||
|                 elif predchozi_poradi : | ||||
|                     predchozi_poradi.poradi = '{0}.'.format(predchozi_poradi.poradi) | ||||
|                     #pokud nebyl rozsah hodnot, pridam tecku za cislo | ||||
|                 posledni_body = tv.body_celkem_rocnik | ||||
|                 tv.poradi = vi + 1 | ||||
|                 #poradi se meni jen u resitele s rozdilnym poctem bodu nez mel minuly | ||||
|                 predchozi_poradi = tv | ||||
|             elif posledni_body == tv.body_celkem_rocnik: | ||||
|                 if not stejne_body.get(tv.body_celkem_rocnik): | ||||
|                     stejne_body[tv.body_celkem_rocnik] = 1 | ||||
|                     #pokud klic neexistuje, zalozim novy pro tohoto resitele | ||||
|                 else: | ||||
|                     stejne_body[tv.body_celkem_rocnik] += 1 | ||||
|                     #rozsirim pocet resitelu sdilejici stejnou pozici | ||||
|             vysledky_resitele[v.resitel.id] = tv | ||||
|             #odkaz na radek vysledkovky patrici danemu resiteli | ||||
|             vysledkovka.append(tv) | ||||
|             v.body_cislo = body_cislo_q[0].body if body_cislo_q else 0 | ||||
| 
 | ||||
|             vysledkovka.append(v) | ||||
| 
 | ||||
|             # připravíme si odkaz na řádek, abychom do něj mohli doplnit body za jednotlivé úlohy | ||||
|             vysledky_resitele[v.resitel.id] = v | ||||
| 
 | ||||
|         # za každé řešení doplníme k příslušnému řešiteli a úloze body | ||||
|         for r in reseni: | ||||
|             vysledky_resitele[r.resitel.id].body[problem_index[r.problem.id]] = r.body | ||||
|          | ||||
|            vysledky_resitele[r.resitel.id].body_ulohy[problem_index[r.problem.id]] = r.body | ||||
|                  | ||||
|         context['vysledkovka'] = vysledkovka | ||||
|         context['problemy'] = problemy | ||||
|  | @ -274,6 +237,11 @@ class CisloView(generic.DetailView): | |||
|         context['resene_problemy'] = resene_problemy | ||||
|         return context | ||||
| 
 | ||||
| class ArchivTemataView(generic.ListView): | ||||
|     model = Problem | ||||
|     template_name = 'seminar/archiv/temata.html' | ||||
|     queryset = Problem.objects.filter(typ=Problem.TYP_TEMA, stav=Problem.STAV_ZADANY).select_related('cislo_zadani__rocnik__rocnik').order_by('-cislo_zadani__rocnik__rocnik', 'kod') | ||||
| 
 | ||||
| ### Generovani vysledkovky | ||||
| 
 | ||||
| class CisloVysledkovkaView(CisloView): | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Aneta
						Aneta