Hello,

Does anybody have a sample code that has a imagefield and upload working
through model form that you could share?

I get weird error

Exception Type: ValueError  Exception Value:

The view mymodule.views.new_store didn't return an HttpResponse object.



when I have the following:

def new_store(request, user_name):
    if request.method == 'POST':
        form = LogForm2(request.POST, request.FILES)
        if form.is_valid():
            for k,v in request.FILES:
                handle_upload_file(v)

            form.save();

            return HttpResponse('1')
    else:
        form = LogForm2()
        return render_to_response('logsystem/upload.html', {'form': form,
'user_name':user_name})


class TestItem(models.Model):

    image_1 = models.ImageField(upload_to='upload/pic1')
    image_2 = models.ImageField(upload_to='upload/pic2')
    image_3 = models.ImageField(blank=True, upload_to='upload/pic3')


class LogForm2(forms.ModelForm):

    class Meta:
        model = TestItem



-- 
http://www.media.mit.edu/~kwan/info.html

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to