Answer the question
In order to leave comments, you need to log in
How to get link in HTML via dlango?
How can I get the link of the image I want? There is a model:
class Tour(models.Model):
name = models.CharField('Место',max_length=50)
bg = models.ImageField('Фон', upload_to='media/')
def tour(request):
places = Tour.objects.all()
context = {'places': places}
return render(request, 'tour/index.html', context)
url("{{ bgs.bg.url }}")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question