[Answered ]-Django Form Post

0👍

Do this:

#settings.py
TEMPLATE_CONTEXT_PROCESSORS = (
    ...,
    'django.core.context_processors.csrf',)

In your view, use csrf decorator instead of manually adding it.

from django.views.decorators.csrf import csrf_protect
from django.template import RequestContext

@csrf_protect
def showWeekEnd(request):
    c = RequestContext(request)
    return render_to_response('EN/current_datetime.html', c)

1👍

Did you try to add RequestContext(request) in your render_to_response ?

views.py

from django.template import RequestContext

return render_to_response('EN/current_datetime.html', c, RequestContext(request))
👤adamr

1👍

from django.shortcuts import render
import datetime

def showWeekEnd(request):           
   if request.method == 'POST':
       return render(request, 'EN/current_datetime.html')

def showTime(request):      
    c = {}
    c["day_list"] = ['wednesday','thursday','friday']
    c["current_date"] = datetime.datetime.now()
    return render(request, 'FR/current_datetime.html', c)

Leave a comment