diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-08-22 00:31:56 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-08-22 00:31:56 +0200 |
commit | d8e86c6d50d5d50cd11a3aabef5ccc0b6d71cfed (patch) | |
tree | 50ed3dbd56724470f898bb58a14264051377277b /ishtar_common/wizards.py | |
parent | 9314f621ef3989ebe6aa01c44fd501299fef8d53 (diff) | |
download | Ishtar-d8e86c6d50d5d50cd11a3aabef5ccc0b6d71cfed.tar.bz2 Ishtar-d8e86c6d50d5d50cd11a3aabef5ccc0b6d71cfed.zip |
Django 1.11: use render() instead render_to_response - pass dict to templates
Diffstat (limited to 'ishtar_common/wizards.py')
-rw-r--r-- | ishtar_common/wizards.py | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index 5217eafae..4a7181e9f 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -36,8 +36,8 @@ from django.db.models.fields import NOT_PROVIDED from django.http import HttpResponseRedirect from django.forms import ValidationError -from django.shortcuts import render_to_response, redirect -from django.template import Context, RequestContext, loader +from django.shortcuts import redirect, render +from django.template import loader from django.utils.datastructures import MultiValueDict as BaseMultiValueDict from django.utils.translation import ugettext_lazy as _ @@ -778,8 +778,7 @@ class Wizard(NamedUrlWizardView): wizard_done_window = unicode(self.wizard_done_window) if wizard_done_window: dct['wizard_done_window'] = wizard_done_window - res = render_to_response(self.wizard_done_template, dct, - context_instance=RequestContext(self.request)) + res = render(self.request, self.wizard_done_template, dct) return return_object and (obj, res) or res def get_deleted(self, keys): @@ -1253,9 +1252,8 @@ class DeletionWizard(Wizard): obj.delete() except ObjectDoesNotExist: pass - return render_to_response( - 'ishtar/wizard/wizard_delete_done.html', {}, - context_instance=RequestContext(self.request)) + return render( + self.request, 'ishtar/wizard/wizard_delete_done.html', {}) class ClosingWizard(Wizard): @@ -1306,9 +1304,8 @@ class ClosingWizard(Wizard): and hasattr(obj, 'end_date'): obj.end_date = form.cleaned_data['end_date'] obj.save() - return render_to_response( - 'ishtar/wizard/wizard_closing_done.html', {}, - context_instance=RequestContext(self.request)) + return render( + self.request, 'ishtar/wizard/wizard_closing_done.html', {}) class PersonWizard(Wizard): @@ -1417,20 +1414,21 @@ class AccountWizard(Wizard): app_name = site and ("Ishtar - " + site.name) \ or "Ishtar" - context = Context({ + context = { 'login': dct['username'], 'password': dct['password'], 'app_name': app_name, 'site': site and site.domain or "" - }) + } t = loader.get_template('account_activation_email.txt') msg = t.render(context) subject = _(u"[%(app_name)s] Account creation/modification") % { "app_name": app_name} send_mail(subject, msg, settings.ADMINS[0][1], [dct['email']], fail_silently=True) - res = render_to_response('ishtar/wizard/wizard_done.html', {}, - context_instance=RequestContext(self.request)) + res = render( + self.request, 'ishtar/wizard/wizard_done.html', {}, + ) return res def get_form_kwargs(self, step=None): |