This commit is contained in:
Xavier59 2017-04-08 18:34:52 +02:00
parent 0fbb58849f
commit cf4bb89fa2
3 changed files with 29 additions and 0 deletions

7
home/forms.py Normal file
View File

@ -0,0 +1,7 @@
from django.conf import settings
from django import forms
class ContactForm(forms.Form):
email = forms.EmailField(label="E-mail")
title = forms.CharField(label="Objet", min_length=settings.OBJECT_MIN_LENGTH, max_length=settings.OBJECT_MAX_LENGTH)
message = forms.CharField(label="Message", min_length=settings.MAILBODY_MIN_LENGTH, max_length=settings.MAILBODY_MAX_LENGTH)

View File

@ -0,0 +1,3 @@
function contact(response){
alert(response)
}

View File

@ -0,0 +1,19 @@
{% extends "base.html" %}
{% load static %}
{% block title %}Planète Casio — Contact{% endblock %}
{% block content %}
<form method="post" action="{% url 'contact' %}" class="with-ajax">
{{ form }}
{% csrf_token %}
<input type="submit" callback="contact" value="Envoyer"/>
</form>
{% endblock %}
{% block javascript %}
{{ block.super }}
<script type="text/javascript" src="{% static 'scripts/contact.js' %}">
{% endblock %}