registration: Track create organization page in GA.

This will help us track if users actually clicked on the
email confirmation link while creating a new organization.

Replaced all the `reder` calls in `accounts_register` with
`TemplateResponse` to comply with `add_google_analytics`
decorator.
This commit is contained in:
Aman Agrawal
2023-02-01 07:05:01 +00:00
committed by Tim Abbott
parent 0f155b597f
commit 9965ad2ea3
3 changed files with 15 additions and 12 deletions

View File

@@ -13,7 +13,7 @@ from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models import CASCADE
from django.http import HttpRequest, HttpResponse
from django.shortcuts import render
from django.template.response import TemplateResponse
from django.urls import reverse
from django.utils.timezone import now as timezone_now
@@ -43,10 +43,10 @@ def render_confirmation_key_error(
request: HttpRequest, exception: ConfirmationKeyError
) -> HttpResponse:
if exception.error_type == ConfirmationKeyError.WRONG_LENGTH:
return render(request, "confirmation/link_malformed.html", status=404)
return TemplateResponse(request, "confirmation/link_malformed.html", status=404)
if exception.error_type == ConfirmationKeyError.EXPIRED:
return render(request, "confirmation/link_expired.html", status=404)
return render(request, "confirmation/link_does_not_exist.html", status=404)
return TemplateResponse(request, "confirmation/link_expired.html", status=404)
return TemplateResponse(request, "confirmation/link_does_not_exist.html", status=404)
def generate_key() -> str: