diff --git a/gergelypolonkai_django/taghelper.py b/gergelypolonkai_django/helper.py similarity index 73% rename from gergelypolonkai_django/taghelper.py rename to gergelypolonkai_django/helper.py index 664b684..1b3151b 100644 --- a/gergelypolonkai_django/taghelper.py +++ b/gergelypolonkai_django/helper.py @@ -2,6 +2,13 @@ from django.db.models import Count from taggit.models import Tag from math import floor from operator import itemgetter +from django.conf import settings +import os +from random import choice + +def randomheader(request): + header_file = choice(filter(lambda x: os.path.isfile(settings.HEADER_DIR + os.path.sep + x), os.listdir(settings.HEADER_DIR))) + return {'header': header_file} def tagcloud(request): tagcloudlist = Tag.objects.annotate(ct=Count('taggit_taggeditem_items')).order_by('-ct') diff --git a/gergelypolonkai_django/settings.py b/gergelypolonkai_django/settings.py index 3391f5b..51ad65c 100644 --- a/gergelypolonkai_django/settings.py +++ b/gergelypolonkai_django/settings.py @@ -131,6 +131,7 @@ INSTALLED_APPS = ( # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', 'blog', + 'basics', ) # A sample logging configuration. The only tangible logging @@ -170,5 +171,8 @@ TEMPLATE_CONTEXT_PROCESSORS = ( "django.core.context_processors.static", "django.core.context_processors.tz", "django.contrib.messages.context_processors.messages", - 'gergelypolonkai_django.taghelper.tagcloud', + 'gergelypolonkai_django.helper.tagcloud', + 'gergelypolonkai_django.helper.randomheader', ) + +HEADER_DIR = SITE_ROOT + os.path.sep + "static" + os.path.sep + "images" + os.path.sep + "header" diff --git a/gergelypolonkai_django/static/images/header/header_1.png b/gergelypolonkai_django/static/images/header/header_1.png new file mode 100644 index 0000000..174632c Binary files /dev/null and b/gergelypolonkai_django/static/images/header/header_1.png differ diff --git a/gergelypolonkai_django/static/images/header/header_2.png b/gergelypolonkai_django/static/images/header/header_2.png new file mode 100644 index 0000000..6e1bd89 Binary files /dev/null and b/gergelypolonkai_django/static/images/header/header_2.png differ diff --git a/gergelypolonkai_django/static/images/header/header_3.png b/gergelypolonkai_django/static/images/header/header_3.png new file mode 100644 index 0000000..66595ac Binary files /dev/null and b/gergelypolonkai_django/static/images/header/header_3.png differ diff --git a/gergelypolonkai_django/static/images/header/header_4.png b/gergelypolonkai_django/static/images/header/header_4.png new file mode 100644 index 0000000..7589c50 Binary files /dev/null and b/gergelypolonkai_django/static/images/header/header_4.png differ diff --git a/gergelypolonkai_django/templates/front_base.html b/gergelypolonkai_django/templates/front_base.html index 920f8c1..a4a6318 100644 --- a/gergelypolonkai_django/templates/front_base.html +++ b/gergelypolonkai_django/templates/front_base.html @@ -18,7 +18,7 @@
-