the subject says it all. I am working on a ad rotation system. I
have to grab the url data of the ad from the datastore database and
then send that data to a html file to put that url in a html image
tag.
any ideas how I should go abouts doing this? Here is what I have so
far:
here is the views.py code:
def get_ad(request):
total_entries = Ad.all().count()
ad_all = Ad.all()[:total_entries]
ad = random.choice(ad_all)
return HttpResponse(ad.adurl)
here is the models.py code
class Ad(db.Model):
name = db.StringProperty()
adurl = db.StringProperty()
number= db.IntegerProperty()
Here is the html code :
<div class="ad"><img src="{{ad_url}}"></div>
any ideas?
currently with the code I show I still see no ads showing up. I even
tried printing some variables and I s till see nothing getting
fetched.
any ideas what I should do?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---