random.py
22 lines
| 455 B
| text/x-python
|
PythonLexer
neko259
|
r1246 | from django.shortcuts import render | ||
from django.views.generic import View | ||||
neko259
|
r1590 | from boards.models import Attachment | ||
neko259
|
r1246 | |||
__author__ = 'neko259' | ||||
TEMPLATE = 'boards/random.html' | ||||
neko259
|
r1249 | CONTEXT_IMAGES = 'images' | ||
neko259
|
r1246 | |||
neko259
|
r1247 | RANDOM_POST_COUNT = 9 | ||
neko259
|
r1246 | |||
class RandomImageView(View): | ||||
def get(self, request): | ||||
params = dict() | ||||
neko259
|
r1590 | params[CONTEXT_IMAGES] = Attachment.objects.get_random_images( | ||
neko259
|
r1249 | RANDOM_POST_COUNT) | ||
neko259
|
r1246 | |||
return render(request, TEMPLATE, params) | ||||