my views.py
:
from django.core.context_processors import csrf
from django.views.decorators.csrf import csrf_protect
from django.http import *
from django.template import *
from django.shortcuts import *
# Create your views here.
@csrf_protect
def homepage(request):
return render_to_response('index.html', {'files':os.listdir('/home/username/public_html/posters') })
@csrf_protect
def upload(request):
return render_to_response('list.html', )
в моем шаблоне index.html
:
All uploaded posters:
{%for file in files %}
{{file}}
{%endfor%}
поэтому, когда я открываю домашнюю страницу в браузере и вижу исходный код и нет токена csrf!
All uploaded posters:
Что я пропустил?
ОБНОВЛЕНИЕ : это помогло.