dynamicweb/digitalglarus/views.py
Dominique Roux 2c4f48a0cb Changed index page
The index page is no set to the crowdfounding page.
The old index page is now called home.
The crowdfounding page is now in the menu on the first place,
and the home page second.
2015-09-20 16:37:54 +02:00

57 lines
1.5 KiB
Python

import datetime
from django.shortcuts import get_object_or_404, render
from django.forms import ModelForm
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from .models import Message
class MessageForm(ModelForm):
required_css_class = 'form-control'
class Meta:
model = Message
fields = ['name', 'email', 'phone_number', 'message' ]
def detail(request, message_id):
p = get_object_or_404(Message, pk=message_id)
context = { 'message': p, }
return render(request, 'digitalglarus/detail.html', context)
def about(request):
return render(request, 'digitalglarus/about.html')
#def index(request):
# return render(request, 'digitalglarus/index.html')
#
#def letscowork(request):
# return render(request, 'digitalglarus/letscowork.html')
def index(request):
return render(request, 'digitalglarus/letscowork.html')
def home(request):
return render(request, 'digitalglarus/index.html')
def letscowork(request):
return render(request, 'digitalglarus/letscowork.html')
def contact(request):
message = Message(received_date=datetime.datetime.now())
form = MessageForm(request.POST, instance=message)
if request.method == 'POST':
if form.is_valid():
form.save()
return HttpResponseRedirect(reverse("digitalglarus:contact"))
# form = MessageForm()
context = {
'form': form,
}
return render(request, 'digitalglarus/contact.html', context)