Browse Source
Nakonec pouzit context_processor, ktery je k tomu urceny. Prida do contextu promenou noc tak, ze pokud je mezi 20. hodinou vecerni a 7. hodinou ranni, pak je noc True. Kdyz je noc True, pak se v base templeatu prida do header class prepona NOC. CSS-ko vuci tomu upravenoremotes/origin/noc
Bc. Petr Pecha
9 years ago
5 changed files with 15 additions and 5 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} |
||||
|
|
Loading…
Reference in new issue