Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions newsletter/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,17 @@ def submit(self, request, object_id):
if submission.sent or submission.prepared:
messages.info(request, _("Submission already sent."))
change_url = reverse(
'admin:newsletter_submission_change', args=[object_id]
'admin:%s_%s_change' % (self.opts.app_label, self.opts.model_name), args=[object_id]
)

return HttpResponseRedirect(change_url)

submission.prepared = True
submission.save()

messages.info(request, _("Your submission is being sent."))

changelist_url = reverse('admin:newsletter_submission_changelist')
changelist_url = reverse('admin:%s_%s_changelist' % (self.opts.app_label, self.opts.model_name))
return HttpResponseRedirect(changelist_url)

""" URLs """
Expand Down Expand Up @@ -439,7 +440,7 @@ def subscribers_import(self, request):
form.cleaned_data['newsletter'].pk

confirm_url = reverse(
'admin:newsletter_subscription_import_confirm'
'admin:%s_%s_import_confirm' % (self.opts.app_label, self.opts.model_name)
)
return HttpResponseRedirect(confirm_url)
else:
Expand All @@ -453,9 +454,8 @@ def subscribers_import(self, request):

def subscribers_import_confirm(self, request):
# If no addresses are in the session, start all over.

if 'addresses' not in request.session:
import_url = reverse('admin:newsletter_subscription_import')
import_url = reverse('admin:%s_%s_import' % (self.opts.app_label, self.opts.model_name))
return HttpResponseRedirect(import_url)

addresses = request.session['addresses']
Expand Down Expand Up @@ -488,7 +488,7 @@ def subscribers_import_confirm(self, request):
)

changelist_url = reverse(
'admin:newsletter_subscription_changelist'
'admin:%s_%s_changelist' % (self.opts.app_label, self.opts.model_name)
)
return HttpResponseRedirect(changelist_url)
else:
Expand Down