|
|
|
@ -24,8 +24,20 @@ def view_mailinglist_unsubscribe(request, slug, uidb36, token): |
|
|
|
newsletter.mailing_list.unsubscribers.add(contact) |
|
|
|
newsletter.mailing_list.unsubscribers.add(contact) |
|
|
|
newsletter.mailing_list.save() |
|
|
|
newsletter.mailing_list.save() |
|
|
|
already_unsubscribed = True |
|
|
|
already_unsubscribed = True |
|
|
|
ContactMailingStatus.objects.create(newsletter=newsletter, contact=contact, |
|
|
|
params = dict(newsletter=newsletter, |
|
|
|
status=ContactMailingStatus.UNSUBSCRIPTION) |
|
|
|
contact=contact, |
|
|
|
|
|
|
|
status=ContactMailingStatus.UNSUBSCRIPTION) |
|
|
|
|
|
|
|
if newsletter.ab_testing: |
|
|
|
|
|
|
|
try: |
|
|
|
|
|
|
|
ab_state = ContactMailingStatus.objects.filter( |
|
|
|
|
|
|
|
newsletter=newsletter, |
|
|
|
|
|
|
|
contact=contact, |
|
|
|
|
|
|
|
status__in=(ContactMailingStatus.SENT_TEST, ContactMailingStatus.SENT), |
|
|
|
|
|
|
|
).order_by('-creation_date')[0].ab |
|
|
|
|
|
|
|
params.update({'ab': ab_state}) |
|
|
|
|
|
|
|
except: |
|
|
|
|
|
|
|
pass |
|
|
|
|
|
|
|
ContactMailingStatus.objects.create(**params) |
|
|
|
|
|
|
|
|
|
|
|
return HttpResponseRedirect(reverse_lazy('newsletter_mailinglist_unsubscribe_success')) |
|
|
|
return HttpResponseRedirect(reverse_lazy('newsletter_mailinglist_unsubscribe_success')) |
|
|
|
|
|
|
|
|
|
|
|
@ -87,8 +99,20 @@ class UnsubscribeView(DetailView): |
|
|
|
context = super(UnsubscribeView, self).get_context_data(**kwargs) |
|
|
|
context = super(UnsubscribeView, self).get_context_data(**kwargs) |
|
|
|
context['subscribe'] = self.get_announce_form() |
|
|
|
context['subscribe'] = self.get_announce_form() |
|
|
|
# |
|
|
|
# |
|
|
|
ContactMailingStatus.objects.create(newsletter=self.object, contact=self.contact, |
|
|
|
params = dict(newsletter=self.object, |
|
|
|
status=ContactMailingStatus.UNSUBSCRIPTION) |
|
|
|
contact=self.contact, |
|
|
|
|
|
|
|
status=ContactMailingStatus.UNSUBSCRIPTION) |
|
|
|
|
|
|
|
if self.object.ab_testing: |
|
|
|
|
|
|
|
try: |
|
|
|
|
|
|
|
ab_state = ContactMailingStatus.objects.filter( |
|
|
|
|
|
|
|
newsletter=self.object, |
|
|
|
|
|
|
|
contact=self.contact, |
|
|
|
|
|
|
|
status__in=(ContactMailingStatus.SENT_TEST, ContactMailingStatus.SENT), |
|
|
|
|
|
|
|
).order_by('-creation_date')[0].ab |
|
|
|
|
|
|
|
params.update({'ab': ab_state}) |
|
|
|
|
|
|
|
except: |
|
|
|
|
|
|
|
pass |
|
|
|
|
|
|
|
ContactMailingStatus.objects.create(**params) |
|
|
|
|
|
|
|
|
|
|
|
return context |
|
|
|
return context |
|
|
|
|
|
|
|
|
|
|
|
|