Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the image_thumbnail.html example causes an error when image exist #199

Open
michaelhjulskov opened this issue Mar 31, 2018 · 3 comments
Open

Comments

@michaelhjulskov
Copy link

Hi

Thanks for sharing
I have a little issue regarding the image_thumbnail.html example.
Issue is, that if an image already is saved and imagefield is required, if i render the form and do not select a new image, my browser will tell me that i need to pick a file. I tried to fix it this way, but it did not solve my issue:

old:

{# image_thumbnail.html #}
....some lines taken ot....
<input type="{{ type }}" name="{{ name }}"{% if required %} required{% endif %}{% include "floppyforms/attrs.html" %}>

new:

{# image_thumbnail.html #}
....some lines taken ot....
<input type="{{ type }}" name="{{ name }}"{% if required and not value.url %} required{% endif %}{% include "floppyforms/attrs.html" %}>

How to fix it? :)

@michaelhjulskov
Copy link
Author

michaelhjulskov commented Mar 31, 2018

a quick test shows that issue dissapear when i remove this:
{% if required %} required{% endif %}{% include "floppyforms/attrs.html" %}

But that isnt a solution obviously.

Hope for someone to help me :) Thanks

@michaelhjulskov
Copy link
Author

This must be an issue that needs to be fixed!
If there already is an image, you dont need to require a new image. Logically!

@michaelhjulskov
Copy link
Author

This hack solves my issue.

  • I removed the delete checkbox from template
  • I added this jquery onload: $("#id_file").prop("required",false);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant