Browse Source

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

middleware_test
Pavel "LEdoian" Turinsky 4 years ago
parent
commit
41e95fc574
  1. 2
      mamweb/settings_common.py
  2. 0
      various/__init__.py
  3. 3
      various/admin.py
  4. 5
      various/apps.py
  5. 14
      various/context_processors.py
  6. 0
      various/migrations/__init__.py
  7. 3
      various/models.py
  8. 3
      various/tests.py
  9. 3
      various/views.py

2
mamweb/settings_common.py

@ -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

3
various/admin.py

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

5
various/apps.py

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

14
various/context_processors.py

@ -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 {}

0
various/migrations/__init__.py

3
various/models.py

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

3
various/tests.py

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

3
various/views.py

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