-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #755 from MTES-MCT/feat-newsletter-form
Ajout d'une page-formulaire d'inscription à la newsletter
- Loading branch information
Showing
22 changed files
with
272 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.views.generic import TemplateView | ||
|
||
from utils.views_mixins import BreadCrumbMixin | ||
|
||
|
||
class AccessView(BreadCrumbMixin, TemplateView): | ||
template_name = "home/accessibilite.html" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from datetime import timedelta | ||
from typing import Any | ||
|
||
from django.http import HttpRequest, HttpResponse, HttpResponseGone | ||
from django.utils import timezone | ||
from django.views.generic import TemplateView | ||
|
||
from home.models import AliveTimeStamp | ||
|
||
|
||
class AliveView(TemplateView): | ||
template_name = "home/alive.html" | ||
|
||
def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: | ||
from_datetime = timezone.now() - timedelta(minutes=35) | ||
default_is_alive = AliveTimeStamp.objects.filter(queue_name="default", timestamp__gte=from_datetime).exists() | ||
long_is_alive = AliveTimeStamp.objects.filter(queue_name="default", timestamp__gte=from_datetime).exists() | ||
if default_is_alive and long_is_alive: | ||
return HttpResponse("All good...") | ||
return HttpResponseGone("Celery workers are not alive.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from django.conf import settings | ||
from django.views.generic import CreateView | ||
|
||
from home.models import ContactForm | ||
|
||
|
||
class ContactView(CreateView): | ||
model = ContactForm | ||
template_name = "home/contact.html" | ||
success_url = "/" | ||
fields = ["email", "content"] | ||
|
||
def get_context_data(self, **kwargs): | ||
kwargs["crisp_website_id"] = settings.CRISP_WEBSITE_ID | ||
return super().get_context_data(**kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from django.contrib.auth.mixins import LoginRequiredMixin | ||
from django.views.generic import TemplateView | ||
|
||
from home.forms import NewsletterForm | ||
from project.models import RNUPackage | ||
from utils.views_mixins import BreadCrumbMixin | ||
|
||
|
||
class DownloadView(LoginRequiredMixin, BreadCrumbMixin, TemplateView): | ||
template_name = "home/download.html" | ||
|
||
def get_context_data(self, **kwargs): | ||
kwargs |= { | ||
"form": NewsletterForm(), | ||
"rnu_packages": RNUPackage.objects.all().order_by("departement_official_id"), | ||
} | ||
return super().get_context_data(**kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from django.views.generic import TemplateView | ||
|
||
from home.forms import NewsletterForm | ||
from utils.views_mixins import BreadCrumbMixin | ||
|
||
|
||
class HomeRapportLocalView(BreadCrumbMixin, TemplateView): | ||
template_name = "home/home_rapport_local.html" | ||
|
||
def get_context_data(self, **kwargs): | ||
kwargs["form"] = NewsletterForm() | ||
return super().get_context_data(**kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from django.views.generic import TemplateView | ||
|
||
from home.forms import NewsletterForm | ||
from utils.views_mixins import BreadCrumbMixin | ||
|
||
|
||
class HomeView(BreadCrumbMixin, TemplateView): | ||
template_name = "home/home.html" | ||
|
||
def get_context_data(self, **kwargs): | ||
kwargs["form"] = NewsletterForm() | ||
return super().get_context_data(**kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.views.generic import TemplateView | ||
|
||
from utils.views_mixins import BreadCrumbMixin | ||
|
||
|
||
class LegalNoticeView(BreadCrumbMixin, TemplateView): | ||
template_name = "home/legal_notices.html" |
Oops, something went wrong.