diff --git a/biscuit/core/forms.py b/biscuit/core/forms.py index f6334c279c01d91585cf7553de888f35b4dea0fe..4605dd42cd75a8efca2828a7f69d0248ae9a8b5c 100644 --- a/biscuit/core/forms.py +++ b/biscuit/core/forms.py @@ -2,6 +2,8 @@ from django import forms from django.contrib.auth import get_user_model from django.utils.translation import ugettext_lazy as _ +from contact_form.forms import ContactForm + from .models import Person, Group @@ -73,3 +75,9 @@ class EditGroupForm(forms.ModelForm): super().__init__(*args, **kwargs) self.fields['members'].queryset = Person.objects.all() self.fields['owners'].queryset = Person.objects.all() + + +class SupportContactForm(ContactForm): + subject_template_name = 'contact_form/support/subject.txt' + template_name = 'contact_form/support/body.txt' + \ No newline at end of file diff --git a/biscuit/core/settings.py b/biscuit/core/settings.py index c8fb0c97a14cf495c7765237e0008a65a27f09bb..07667f7bfb2c77ac3d1eb6697feb9f652b53e60a 100644 --- a/biscuit/core/settings.py +++ b/biscuit/core/settings.py @@ -61,6 +61,7 @@ INSTALLED_APPS = [ 'menu_generator', 'phonenumber_field', 'debug_toolbar', + 'contact_form', 'biscuit.core' ] diff --git a/biscuit/core/urls.py b/biscuit/core/urls.py index 529becd8ae9826a98c7be9232a2be973251c14b5..ebd83ba705c7c9520211d56727f8ab3b99839767 100644 --- a/biscuit/core/urls.py +++ b/biscuit/core/urls.py @@ -3,10 +3,14 @@ from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import include, path +from django.views.generic import TemplateView + +from contact_form.views import ContactFormView import debug_toolbar from . import views +from .forms import SupportContactForm urlpatterns = [ path('admin/', admin.site.urls), @@ -26,6 +30,10 @@ urlpatterns = [ path('group/<int:id_>/edit', views.edit_group, name='edit_group_by_id'), path('', views.index, name='index'), path('maintenance-mode/', include('maintenance_mode.urls')), + path('contact/support/', ContactFormView.as_view(form_class=SupportContactForm), + name='support_contact_form')) + path('contact/support/sent/', TemplateView.as_view(template_name='contact_form/support/sent.html'), + name='support_contact_form_sent'), path('__i18n__/', include('django.conf.urls.i18n')) ] diff --git a/pyproject.toml b/pyproject.toml index 8768e6df184286dbfe003a6e957acf990818813e..768f1ac01d7e02718d917ceb4284ddf61479ad6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,6 +42,7 @@ django-maintenance-mode = "^0.13.3" django-ipware = "^2.1" easy-thumbnails = "^2.6" django-image-cropping = "^1.2" +django-contact-form = "^1.7" [tool.poetry.extras] ldap = ["django-auth-ldap"]