Ticket #9074: views.py

File views.py, 622 bytes (added by John Shimek, 16 years ago)

example views.py to reproduce

Line 
1from django import forms
2from django.http import HttpResponseRedirect
3from django.shortcuts import render_to_response
4
5class ZipFileForm(forms.Form):
6 gallery = forms.CharField()
7 zip_file = forms.FileField()
8
9def add_pictures_from_zip(request):
10 if request.method == 'POST':
11 form = ZipFileForm(request.POST, request.FILES)
12 if form.is_valid():
13 form.save()
14 return HttpResponseRedirect('/admin/dali/picture/')
15 else:
16 form = ZipFileForm()
17
18 title = "Add multiple pictures"
19 return render_to_response('upload_zip_file.html', {'form': form, 'title': title})
Back to Top