question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot update ImageField to a new image file (Wagtail 1.3.1, Python 3.4.4)

See original GitHub issue

When 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:closed
  • Created 8 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mx-mothcommented, Mar 31, 2016

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!

0reactions
gasmancommented, Jun 10, 2016
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found