Hi, I'm a django newb and I am trying to make an upload form.
my view is:
11 def newupload(request):
12 manipulator = PFile.AddManipulator()
13 username = request.user.username
14 u = User.objects.get(username=username)
15
16 if request.POST:
17 new_data = request.POST.copy()
18 new_data.update(request.FILES)
19 new_data['owner'] = u.id
20 manipulator.do_html2python(new_data)
21 manipulator.save(new_data)
22 return HttpResponseRedirect('/url/on_success/')
23 else:
24 form = PDBFile()
25 return render_to_response('html/fupload.html', {'form':
form})
and my template is:
<body bgcolor=#FFFFFF>
<table>
<form enctype="multipart/form-data" method="post" action="/
fileupload/">
<p><label for="pdb_file"> File Uploader </label>
{{ form.puploadfile }} {{ form.pupload_file }}</P>
<tr><td><input type="submit" /></td></tr>
</form>
</table>
my model is very simple:
5 class PFile(models.Model):
6 puploadfile = models.FileField(upload_to='usr/')
7 owner = models.ForeignKey(User)
The only output I get to the screen is "PDB File Uploader" and the
"submit" button. Any ideas? I was basing my template off of:
http://www.djangoproject.com/documentation/0.95/forms/
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---