Založena aplikace 'various' na random věci

This commit is contained in:
Pavel "LEdoian" Turinsky 2021-03-31 21:30:51 +02:00
parent 08e31a849c
commit 41e95fc574
9 changed files with 33 additions and 0 deletions

View file

@ -78,6 +78,7 @@ TEMPLATES = [
'django.contrib.messages.context_processors.messages',
'sekizai.context_processors.sekizai',
'header_fotky.context_processors.vzhled',
'various.context_processors.april',
)
},
},
@ -132,6 +133,7 @@ INSTALLED_APPS = (
'korektury',
'prednasky',
'header_fotky',
'various',
# Admin upravy:

0
various/__init__.py Normal file
View file

3
various/admin.py Normal file
View file

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

5
various/apps.py Normal file
View file

@ -0,0 +1,5 @@
from django.apps import AppConfig
class VariousConfig(AppConfig):
name = 'various'

View file

@ -0,0 +1,14 @@
def april(req):
if 'X-April' in req.headers:
try:
year = int(req.headers['X-April'])
return {'april': year}
except:
pass # Fall-back to regular behaviour
import datetime
today = datetime.date.today()
if today.day == 1 and today.month == 4:
return {'april': today.year}
return {}

View file

3
various/models.py Normal file
View file

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

3
various/tests.py Normal file
View file

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

3
various/views.py Normal file
View file

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.