Browse Source
Pokud je noc, prida do class header NOC a tim se prepne sada fotek na nocni. Funguje to jenom u generickych view. Flatpages umim udelat, ale prepisu kus flatpages. Jine nez genericka view se musi predelat tak, aby pri postupu response procházelo idealne pres process_template_responseremotes/origin/noc
Bc. Petr Pecha
9 years ago
11 changed files with 47 additions and 1 deletions
@ -0,0 +1,35 @@ |
|||||
|
|
||||
|
from datetime import datetime, date |
||||
|
|
||||
|
class vzhled: |
||||
|
|
||||
|
def process_request(self, request): |
||||
|
return None |
||||
|
|
||||
|
def process_view(self, request, view_func, view_args, view_kwargs): |
||||
|
#print "====== process_request ======" |
||||
|
#print view_func |
||||
|
#print view_args |
||||
|
#print view_kwargs |
||||
|
#print "=============================" |
||||
|
return None |
||||
|
|
||||
|
def process_template_response(self, request, response): |
||||
|
hodin = datetime.now().hour |
||||
|
if (hodin <= 6) or (hodin >= 14): # TODO 20 |
||||
|
response.context_data['noc'] = True |
||||
|
else: |
||||
|
response.context_data['noc'] = False |
||||
|
return response |
||||
|
|
||||
|
def process_response(self, request, response): |
||||
|
#hodin = datetime.now().hour |
||||
|
#if (hodin <= 6) or (hodin >= 14): # TODO 20 |
||||
|
#response.context_data['noc'] = True |
||||
|
#else: |
||||
|
#response.context_data['noc'] = False |
||||
|
return response |
||||
|
|
||||
|
|
||||
|
##def process_exception(request, exception): |
||||
|
#pass |
After Width: | Height: | Size: 251 KiB |
After Width: | Height: | Size: 61 KiB |
After Width: | Height: | Size: 388 KiB |
After Width: | Height: | Size: 316 KiB |
After Width: | Height: | Size: 256 KiB |
After Width: | Height: | Size: 204 KiB |
Loading…
Reference in new issue