Skip to content

Commit

Permalink
CSRF tokens now added to the forms
Browse files Browse the repository at this point in the history
  • Loading branch information
lachie committed Mar 3, 2010
1 parent a56f5e1 commit 1cf5102
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions smuggler/templates/smuggler/load_data_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ <h1>{% trans "Load data" %}</h1>

<div>
<form enctype="multipart/form-data" method="post" action="">
{% csrf_token %}
<div>
{% if import_file_form.errors %}
<p class="errornote">{% trans "Please correct the error below." %}</p>
Expand Down Expand Up @@ -68,6 +69,7 @@ <h1>{% trans "Load data" %}</h1>
{% if files_available %}
<div>
<form method="post" action="">
{% csrf_token %}
<div class="inline-group">
{% comment %}
# TODO: implement this error message
Expand Down
3 changes: 2 additions & 1 deletion smuggler/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ def load_data(request):
file_data = uploaded_file.read()
data.append((file_format, file_data))
elif request.POST.has_key('_loadfromdisk'):
query_dict = request.POST.copy()
query_dict = request.POST.copy()
del(query_dict['_loadfromdisk'])
del(query_dict['csrfmiddlewaretoken'])
selected_files = query_dict.values()
for file_name in selected_files:
file_path = os.path.join(SMUGGLER_FIXTURE_DIR, file_name)
Expand Down

0 comments on commit 1cf5102

Please sign in to comment.