Commit 87ea8d5f authored by Patrick Kimber's avatar Patrick Kimber

Contact (enquiry) page

parent b20cf28f
......@@ -11,4 +11,5 @@
{% block content %}
{% include 'block/_settings.html' with no_header_footer=True %}
{% include 'enquiry/_settings.html' %}
{% include 'mail/_settings.html' %}
{% endblock content %}
......@@ -3,6 +3,7 @@
This command is designed to be run multiple times. It will clear out data, and
then re-insert e.g. for setting up the main menu navigation.
"""
from django.core.management import call_command
from django.core.management.base import BaseCommand
from block.models import (
......@@ -13,40 +14,46 @@ from block.models import (
TemplateSection,
Url,
)
from compose.models import SECTION_BODY, SECTION_SLIDESHOW, Feature
from compose.models import SECTION_BODY, SECTION_CARD, SECTION_SLIDESHOW
class Command(BaseCommand):
help = "Set-up project"
def _init_enquiry_page(self):
"""These sections should already exist."""
body = Section.objects.get(slug=SECTION_BODY)
card = Section.objects.get(slug=SECTION_CARD)
slideshow = Section.objects.get(slug=SECTION_SLIDESHOW)
# contact pages
def init_enquiry_page(self):
"""Initialise the 'enquiry' app to work with the 'compose' app."""
template_article = Template.objects.get(name="Article")
thank = Page.objects.init_page(
"contact", "thankyou", "Thank you", 0, template_article
)
thank.refresh_sections_from_template()
self.stdout.write("{} page created".format(thank.name))
# contact
template_contact = Template.objects.init_template(
"Contact", "compose/contact.html"
)
for section_slug in (SECTION_BODY, SECTION_CARD, SECTION_SLIDESHOW):
section = Section.objects.get(slug=section_slug)
TemplateSection.objects.init_template_section(
template_contact, section
)
contact = Page.objects.init_page(
Page.CUSTOM,
"contact",
"Contact",
7,
"compose/page_article.html",
0,
template_contact,
is_custom=True,
)
thankyou = Page.objects.init_page(
"contact", "thankyou", "Thank you", 8, "compose/page_article.html"
)
PageSection.objects.init_page_section(contact, body)
PageSection.objects.init_page_section(contact, card)
PageSection.objects.init_page_section(contact, slideshow)
PageSection.objects.init_page_section(thankyou, body)
PageSection.objects.init_page_section(thankyou, card)
PageSection.objects.init_page_section(thankyou, slideshow)
contact.refresh_sections_from_template()
self.stdout.write("{} page created".format(contact.name))
Url.objects.init_reverse_url("Contact", "web.contact")
# Link wizard
Url.objects.init_pages()
def handle(self, *args, **options):
self.stdout.write("{}".format(self.help))
self._init_enquiry_page()
call_command("init_app_compose")
self.init_enquiry_page()
self.stdout.write("{} - Complete".format(self.help))
# -*- encoding: utf-8 -*-
import pytest
from django.core.management import call_command
from block.tests.factories import SectionFactory
from compose.models import SECTION_BODY, SECTION_CARD, SECTION_SLIDESHOW
@pytest.mark.django_db
def test_init_project():
call_command("init_app_compose")
call_command("init_project")
......@@ -40,6 +40,7 @@ urlpatterns = [
url(regex=r"^dash/", view=include("dash.urls")),
url(regex=r"^enquiry/", view=include("enquiry.urls")),
url(regex=r"^gdpr/", view=include("gdpr.urls")),
url(regex=r"^mail/", view=include("mail.urls")),
url(regex=r"^wizard/", view=include("block.urls.wizard")),
# this url include should come last
url(regex=r"^", view=include("block.urls.cms")),
......
......@@ -7,8 +7,7 @@ from celery.schedules import crontab
from kombu import Exchange, Queue
DATABASE = "dev_www_hatherleighcommunitymarket_org_patrick"
DATABASE = "test_www_hatherleighcommunitymarket_org_patrick"
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
......
{% extends 'block/base.html' %}
{% load static %}
{% block menu_extra %}
{{ block.super }}
<li class="pure-menu-item{% if 'contact' in path %} pure-menu-selected{% endif %}">
<a href="{% url 'web.contact' %}" class="pure-menu-link">
Contact Us
</a>
</li>
{# use an exact match on the path if you want to add a design menu #}
{% if path == '/contact/' or path == '/custom/contact/design/' %}
{% include 'block/_design_menu.html' %}
{% endif %}
{% endblock menu_extra %}
{% block footer %}
<div class="legal pure-g">
<div class="pure-u-1 pure-u-md-2-5">
......
......@@ -2,11 +2,18 @@
from django.views.generic import CreateView
from block.models import Page
from block.views import PageFormMixin
from block.views import CmsMixin, ContentPageMixin, PageMixin, PageTemplateMixin
from enquiry.views import EnquiryCreateMixin
class EnquiryCreateView(PageFormMixin, EnquiryCreateMixin, CreateView):
class EnquiryCreateView(
PageMixin,
PageTemplateMixin,
EnquiryCreateMixin,
ContentPageMixin,
CmsMixin,
CreateView,
):
"""Save an enquiry in the database."""
def get_success_url(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment