django popup mixin use with class based views
from django.utils.html import escape
class RelatedMixin(object):
def form_valid(self, form):
popup = self.request.GET.get('popup', None)
if popup:
return HttpResponse(
"<script type='text/javascript'>
opener.dismissAddAnotherPopup(window, '%s', '%s');
</script>" %
(escape(form.instance.pk), escape(form.instance)))
return super(RelatedMixin, self).form_valid(form)