Inline ->
On Wed, Sep 10, 2008 at 3:11 PM, Kwan Hong Lee <[EMAIL PROTECTED]> wrote:
> 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')
>
> What happens when the form is invalid? Here you miss the HttpResponse
object
>
> 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
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---