The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ

Created random header image code

master
Gergely Polonkai 9 years ago
parent a99ca61159
commit 414ff5b4a4
  1. 7
      gergelypolonkai_django/helper.py
  2. 6
      gergelypolonkai_django/settings.py
  3. BIN
      gergelypolonkai_django/static/images/header/header_1.png
  4. BIN
      gergelypolonkai_django/static/images/header/header_2.png
  5. BIN
      gergelypolonkai_django/static/images/header/header_3.png
  6. BIN
      gergelypolonkai_django/static/images/header/header_4.png
  7. 2
      gergelypolonkai_django/templates/front_base.html

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

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

@ -18,7 +18,7 @@
</head>
<body>
<div id="content-wrapper">
<div id="header" style="background-image: url('{% static "images/random_header.jpg" %}');">
<div id="header" style="background-image: url('{% static "images/header/"|add:header %}');">
<div id="picture">
<img src="{% static "images/profile.png" %}" alt="" />
</div>

Loading…
Cancel
Save