Shouldn't the error messages be displayed on the same page (using ajax)
without navigating to a different page? We can redirect to the edit card
fields page and display an error message but that would also reset all the
fields. Thoughts?


On Thu, May 8, 2014 at 4:49 PM, Arthur <notifications@github.com> wrote:

> In harvardcards/apps/flash/views/deck.py:
>
> >          for field_name, field_value in request.FILES.items():
> >              if field_name.startswith(field_prefix):
> >                  field_id = field_name.replace(field_prefix, '')
> >                  if field_id.isdigit():
> >                      if request.FILES[field_name].size > 0:
> > -                        path = services.handle_uploaded_img_file(request.FILES[field_name], deck.id, deck.collection.id)
> > -                        fields.append({"field_id": int(field_id), "value": path})
> > +                        if request.FILES[field_name]:
> > +                            if not services.valid_uploaded_file(request.FILES[field_name], 'I'):
> > +                                return HttpResponse(json.dumps({"message":"The uploaded image file type is not supported."}))
>
> This view should return HTML, not JSON.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/Harvard-ATG/HarvardCards/pull/55/files#r12451746>
> .
>