author | Shantanu <shantanu@fossee.in> |
Sun, 24 Jan 2010 14:51:37 +0530 | |
changeset 10 | ddcbd6929a44 |
parent 5 | a1fe7806d6a0 |
child 12 | 10d86ada90c2 |
permissions | -rw-r--r-- |
1
a370c5796d08
Initialized the registration application.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
1 |
#can add features like: supporting files with specified extensions, making edit box of content better etc. |
a370c5796d08
Initialized the registration application.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
2 |
from django.http import HttpResponse |
a370c5796d08
Initialized the registration application.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
3 |
from django.template import Context, Template |
a370c5796d08
Initialized the registration application.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
4 |
from django.shortcuts import render_to_response |
a370c5796d08
Initialized the registration application.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
5 |
|
a370c5796d08
Initialized the registration application.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
6 |
from forms import ParticipantForm |
a370c5796d08
Initialized the registration application.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
7 |
from models import Participant |
a370c5796d08
Initialized the registration application.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
8 |
|
a370c5796d08
Initialized the registration application.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
9 |
def upload_file(request, template_name='index.html'): |
a370c5796d08
Initialized the registration application.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
10 |
if request.method == 'POST': |
a370c5796d08
Initialized the registration application.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
11 |
form = ParticipantForm(request.POST, request.FILES) |
5 | 12 |
if form.is_valid(): |
1
a370c5796d08
Initialized the registration application.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
13 |
form.save() |
a370c5796d08
Initialized the registration application.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
14 |
return render_to_response(template_name, {'form': form, 'value': False,}) |
a370c5796d08
Initialized the registration application.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
15 |
else: |
a370c5796d08
Initialized the registration application.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
16 |
return render_to_response(template_name, {'form': form, 'value': True,}) |
a370c5796d08
Initialized the registration application.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
17 |
return render_to_response(template_name, |
a370c5796d08
Initialized the registration application.
Shantanu <shantanu@fossee.in>
parents:
diff
changeset
|
18 |
{'form': ParticipantForm(), 'value': True}) |