Opened 19 years ago
Closed 18 years ago
#934 closed defect (duplicate)
ImageField's cause the admin UI to not allow modifications?
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Validators | Version: | |
Severity: | normal | Keywords: | david.ascher@gmail.com |
Cc: | django@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
my model can be boiled down to:
class TestAccount(meta.Model):
photo = meta.ImageField(upload_to="/Users/davida/svk/bankofdad/m/photos", default=)
def repr(self): return self.photo
class META:
ordering = ('-photo',)
admin = meta.Admin()
i can create TestAccount instances, but I can't go back and edit one and save. If I do, I always get:
Enter a valid filename.
in the field corresonding to the photo (this even if I browse... to another image).
Change History (6)
comment:1 by , 19 years ago
Summary: | ImageField's are modifiable in the admin UI? → ImageField's cause the admin UI to not allow modifications? |
---|
comment:2 by , 19 years ago
Keywords: | david.ascher@gmail.com added |
---|
comment:3 by , 19 years ago
Component: | Admin interface → Validators |
---|
This one bit me for a few hours today, too. The solution for me was to set MEDIA_ROOT in my settings.py, as the file and image field validators check to ensure that the uploaded file will land inside MEDIA_ROOT. This affects all file fields, not just the admin interface.
Short term solution: MEDIA_ROOT and friends need to be documented a lot more comprehensively.
Long term solution: this MEDIA_ROOT stuff is confusing and restrictive. What if I want a different machine to serve banner ad images than the one which serves site graphics? Something more flexible is needed. I'm not the man for the job, though.
comment:4 by , 18 years ago
Cc: | added |
---|
Not only you have to set MEDIA_ROOT, it also has to be an absolute path.
It is actually the only place anywhere in Django that really requires an absolute path. Everything else works fine with relative paths if you are careful about always chdir'ing to the same directory.
comment:5 by , 18 years ago
Cc: | added; removed |
---|
comment:6 by , 18 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
#651 covers the issue of not allowing directories names in FileField
s, which is the crux of this ticket.
Other issues brought up in the comments should be made as new tickets if they are to get attention.
(also, should note that I'm on rev 1448