I want to insert another view into a view.
Basically I'm using Django filter package and value output directly populates template without my need to writing any view class.
I want to insert another html into the current template.
Something like this: {% include 'countsnippet' %}
, but this gives me error template doesn't exists.
Alternatively I've tried using {% include 'countsnippet.html' %}
but this doesn't calls the views and fields remains empty.
What approach I can use to include another view?
This is my countsnippet html.
{% block content %}
<p> INFT : {{ inft }} </p>
{% endblock %}
I've already made view for countsnippet and its url looks like this:
url(r'countsnippet/$', countsnippet, name='countsnippet')
This is snippet for countsnippet view:
def countsnippet(request):
checkins = Attendee.objects.filter(checkin=True)
inft = Attendee.objects.filter(branch='INFT')
cmpn = Attendee.objects.filter(branch='CMPN')
mms = Attendee.objects.filter(branch='MMS')
return render( request, 'search/countsnippet.html', {'inft':
(checkins&inft).count(), 'cmpn': (checkins&cmpn).count(), 'mms':
(checkins&mms).count()} )