Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # views.py
- from django.http import HttpResponse
- from django.shortcuts import render_to_response
- from models import Ad
- import random
- def index(request):
- total_entries = Ad.all().count()
- ad_all = Ad.all()[:total_entries]
- ad = random.choice(ad_all)
- return HttpResponse(ad.url)
- # models.py
- from google.appengine.ext import db
- class Ad(db.Model):
- url = db.StringProperty()
Add Comment
Please, Sign In to add comment