#32679: Django model not updating image field correctly (Raw content)
-------------------------------------+-------------------------------------
Reporter: Marisol Cardozo | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: models | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):
* status: new => closed
* ui_ux: 1 => 0
* resolution: => invalid
Comment:
You cannot use `.update()` for updating a `FileField`/`ImageField`, in
that way you will update only a filename in the database. You should use
[https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.fields.files.FieldFile.save
FieldFile.save()]. If you're having trouble understanding how Django
works, see TicketClosingReasons/UseSupportChannels for ways to get help.
There is also an open ticket #29607 for adding extra examples to the
"Managing files" topic.
--
Ticket URL: <https://code.djangoproject.com/ticket/32679#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.438c97b07ed22147e6ab5a8fdd929801%40djangoproject.com.