Example #1
0
def request_image(request):
    form = ImageRequestForm(request.POST or None)

    if form.is_valid():
        instance = form.instance
        instance.user = request.user
        instance.save()
        
        return redirect(reverse('index'))

    return render_to_response('image/imagerequest_form.html',
            {'form':form},
            context_instance=RequestContext(request))
Example #2
0
    def test_required_location_field(self):
        imageform = ImageRequestForm(data={"location":"Tulsa"})
        imageform.is_valid()

        self.assertEqual(imageform.errors['description'], [u'This field is required.'])