Cannot update ImageField to a new image file (Wagtail 1.3.1, Python 3.4.4)
See original GitHub issueWhen I initially save an image to an ImageField that is a subclass of Page the image is properly saved. An update to that image sets the ImageField’s path to an invalid path and doesn’t upload the file.
Steps to reproduce:
wagtail start image_field_test
cd image_field_test/
Change home/model.py definition to :
from __future__ import unicode_literals
from django.db import models
from wagtail.wagtailcore.models import Page
from wagtail.wagtailadmin.edit_handlers import FieldPanel
class HomePage(Page):
image = models.ImageField(upload_to='uploaded_images', default='')
content_panels = Page.content_panels + [
FieldPanel('image'),
]
mkdir -p media/uploaded_images
chmod -R 777 media
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
- Log into the admin interface and navigate to the home page (currently http://127.0.0.1:8000/admin/pages/3/edit/).
- Add an image and publish
- Go back to the page and notice how the image path is missing the uploaded_images prefix and clicking on the link goes nowhere. The file is also not present in the file system.
- When creating a new home page I can add an image once. On update I get the problem detailed above.
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to Update ImageField in Django? - python - Stack Overflow
My image Upload is working fine.i can not Update image while updating data.rest of the data are updated.i don't know how to update...
Read more >Using images in templates - Wagtail Documentation
If you haven't updated the project settings, this will be a SQLite database file in the project directory. 5. Create an admin user:...
Read more >Custom image models - Wagtail's documentation
The Image model can be customised, allowing additional fields to be added to images. To do this, you need to add two models...
Read more >conda-forge - :: Anaconda.org
aiida-fleur, 1.3.1, MIT, X, Python FLEUR simulation package containing an ... Fast image augmentation library and easy to use wrapper around other libraries....
Read more >django cms Documentation | Manualzz
For the new django CMS developer, from installation to creating your own addon ... You can use SQLite, which is included in Python...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve tracked down the issue to some code in django-modelcluster. I’ve fixed it there, created a PR (torchbox/django-modelcluster#53), and started a PR (#2422) to fix it in Wagtail once the django-modelcluster issue is fixed. Thanks for your bug reports!
Fixed in #2422 (and more specifically https://github.com/torchbox/django-modelcluster/pull/53)