##// END OF EJS Templates
Other lookalike of favorite threads list
Other lookalike of favorite threads list

File last commit:

r1249:93f2906a default
r1325:96250c6d default
Show More
random.py
22 lines | 453 B | text/x-python | PythonLexer
neko259
Add random images list view
r1246 from django.shortcuts import render
from django.views.generic import View
neko259
Don't return posts with the same image in random view
r1249 from boards.models import PostImage
neko259
Add random images list view
r1246
__author__ = 'neko259'
TEMPLATE = 'boards/random.html'
neko259
Don't return posts with the same image in random view
r1249 CONTEXT_IMAGES = 'images'
neko259
Add random images list view
r1246
neko259
Center random images
r1247 RANDOM_POST_COUNT = 9
neko259
Add random images list view
r1246
class RandomImageView(View):
def get(self, request):
params = dict()
neko259
Don't return posts with the same image in random view
r1249 params[CONTEXT_IMAGES] = PostImage.objects.get_random_images(
RANDOM_POST_COUNT)
neko259
Add random images list view
r1246
return render(request, TEMPLATE, params)