Opened 17 years ago
Last modified 13 years ago
#7415 closed
FileFields have wrong url in admin under Windows, when using upload_to path — at Version 3
Description (last modified by ) ¶
Right now (revision 7612) AdminFileWidget is implemented this way:
if value: output.append('%s <a target="_blank" href="%s%s">%s</a> <br />%s ' % \ (_('Currently:'), settings.MEDIA_URL, value, value, _('Change:')))
The value in database contains \ as a path separator. It is shown as a url instead of needed / separator for urls. Works as is under Unix, but clearly not on Windows.
Model get_<field>_url() method gives the url with correct path separator. Perhaps it should be used in the link instead of value.
Change History (3)
comment:1 by , 17 years ago
comment:2 by , 17 years ago
Django creates the file path with '\' itself in database after uploading the file via admin.
comment:3 by , 17 years ago
Description: | modified (diff) |
---|
Note:
See TracTickets
for help on using tickets.
As I know, it's better to define all paths with '/' not depending on platform - it is valid. I do so and have no such problem as you described.