I have a report.html template in which I need to dynamically change the name of images. I've done a lot of research and trial and error. But I just can't get the URLs for the images to be correct.
The images are in /templates/users/reports/rptemplate/images.
After researching static images, I also copied the images to:
/static/images.
Here's my latest html:
<?xml version="1.0" encoding="UTF-8"?>
{% load staticfiles %} 
<html>
...
              <img alt="" src="static/images/{{img_vision}}">
...
This is my report view:
class UserReportView(LoginRequiredMixin, TemplateView):
    model = User
    template_name = 'users/reports/rptemplate/report.html'
    def get_context_data(self, **kwargs):
        #context = super(DisplayTaskView, self).get_context_data(kwargs)
            #TODO: retrieve the actual data
        context = {'sid': 519893,
        'church_name': 'Lakeview Bible',
        'report_date': '5 Feb 2018',
        'responses': 57,
        'img_vision': 'image1.png',
        'img_leadership': 'image1.png',
        'img_mobilization': 'image1.png',
        'img_stewardship': 'image1.png',
        'img_context': 'image1.png',
        'img_evangelism': 'image1.png',
        'img_discipleship': 'image1.png',
        'img_service': 'image1.png',
        'img_fellowship': 'image1.png',
        'img_worship': 'image1.png',
        'img_category': 'image1.png',
        'img_radar': 'image1.png'
        }  
        return context
And this is my user/url.py:
from django.conf.urls import url
from django.views.generic import TemplateView
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from . import views
urlpatterns = [
    url(
        regex=r'^$',
        view=views.UserListView.as_view(),
        name='list'
    ),
    url(
        regex=r'^~redirect/$',
        view=views.UserRedirectView.as_view(),
        name='redirect'
    ),
    url(
        regex=r'^(?P<username>[\w.@+-]+)/$',
        view=views.UserDetailView.as_view(),
        name='detail'
    ),
    url(
        regex=r'^~update/$',
        view=views.UserUpdateView.as_view(),
        name='update'
    ),
    url(
        regex=r'^reports/rptemplate/$',
        view=views.UserReportView.as_view(),
        name='report'
    ),
]
urlpatterns += staticfiles_urlpatterns()
So where is my mistake? How do I dynamically specify the name of a static file?