Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
81 lines (74 sloc) 2.15 KB
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponse
from random import choice, sample
from facts.models import Fact
from testimonials.models import Testimonial
#def funfact(request):
#return HttpResponse(simplejson.dumps(response_dict), mimetype='application/javascript')
def index(request):
testimonials = Testimonial.objects.all()[:3]
facts = Fact.objects.all()[:10]
objects = ['a kangaroo',
'a mailbox',
'a women',]
actions = ['walking by it',
'gazing at it',
'thinking about it',
'talking to it', ]
diseases = ['xenophobia',
'avian flu',
'mad cow disease',
effects = ['go moist',
'think about their fathers',
'cry with joy',
'gaze at the stars',
'have well formed octuplets',
'realize the meaning of life',
descriptions = ['hot',
'big busted',
'(legal aged) teenage',
'extremely ugly',
# Pick two random description
descriptionSeq = sample(descriptions, 2)
#fact01 = "Sigurd can impregnate %s just by %s." % (choice(objects), choice(actions))
fact02 = "Sigurd's semen cures %s." % choice(diseases)
fact03 = "Sigurd's sperm makes %s, %s women %s." % (descriptionSeq[0], descriptionSeq[1], choice(effects))
funfacts = [fact02, fact03]
return render_to_response('index.html', {
'testimonials': testimonials,
'genfact': choice(funfacts),
'facts': facts,
}, context_instance=RequestContext(request))