I have a models.py
structure similar to this
class Entertainmentblog(models.Model):
slug = models.SlugField(max_length=100)
body = models.TextField()
posted = models.DateTimeField('date published')
img_url0 = models.CharField(max_length=100)
img_alt0 = models.CharField(max_length=100)
title1 = models.CharField(max_length=100)
def __unicode__(self):
return self.title
Now if I have to take one of the blog posts and display it as a image masthead on the top of the page.
How do I do this?
Perform your query and then index it, probably using the 0th index. This will add a LIMIT
clause to the underlying query.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.