Beispiel #1
0
def index(request):
  template = 'index.html'
  this_image = NounExternal.get_random()
  data = {'noun': this_image}

  context = RequestContext(request)
  return render_to_response(template, data, context)
Beispiel #2
0
def random_noun(request, width = None, height = None, debug = False):
  track_page_view(request)

  if width and height:
    nouns = NounExternal.objects.only('noun').distinct().values_list('noun', flat = True)
    noun = random.choice(nouns)
    return noun_static(request, noun, width, height, debug)
  else:
    this_image = NounExternal.get_random()
    if debug:
      return detail(request, this_image)
    return this_image.http_image