Bc. Petr Pecha
9 years ago
12 changed files with 58 additions and 2 deletions
@ -0,0 +1,12 @@ |
|||||
|
|
||||
|
from datetime import datetime, date |
||||
|
|
||||
|
def vzhled(request): |
||||
|
''' Podle casu prida do templatu, zdali je nebo neni noc ''' |
||||
|
hodin = datetime.now().hour |
||||
|
if (hodin <= 6) or (hodin >= 20): |
||||
|
noc = True |
||||
|
else: |
||||
|
noc = False |
||||
|
return {'noc' : noc} |
||||
|
|
@ -0,0 +1,36 @@ |
|||||
|
|
||||
|
from django.http import HttpResponse |
||||
|
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