1👍
✅
The key concept here is context. Context is handled for you in class based views (though it is extendable), but in a function based view you need to pass it along to the template explicitly. You’re actually already doing this in…
return render(request, 'send_notifications.html', {'subject': subject, 'message': message})
There you are passing ‘subject’ and ‘message’ along as context. Passing along group is as simple as adding the key and the value to the context object.
return render(request, 'send_notifications.html', {'subject': subject, 'message': message, 'group': group})
or
return render(request, 'send_notifications.html', {'group': group})
in the unPOST version.
Source:stackexchange.com