home / django_tickets / tickets

tickets: 7843

This data as json

id created changetime last_pulled_from_trac stage status component type severity version resolution summary description owner reporter keywords easy has_patch needs_better_patch needs_tests needs_docs ui_ux
7843 2008-07-19 21:12:56 2008-07-19 22:26:33 2022-03-06 03:40:42.307135 Unreviewed closed Database layer (models, ORM)     dev fixed r7986 breaks uploaded files stored in date-based directories After updating to a Django revision post- [7986], get_FIELD_url is broken for all FileField and ImageField uploads using an upload_to with date-based directory parts. [7986] updates get_FIELD_url to call field.get_filename on the DB-stored path. field.get_filename only uses the basename of its argument, and calls field.get_directory_name for the directory part. field.get_directory_name uses datetime.now() for interpolating the date parts into upload_to. From django/db/models/fields/__init__.py: {{{ def get_directory_name(self): return os.path.normpath(force_unicode(datetime.datetime.now().strftime( def get_filename(self, filename): from django.utils.text import get_valid_filename f = os.path.join(self.get_directory_name(), get_valid_filename(os.path. return os.path.normpath(f) }}} This means that instead of returning a URL with the correct path that is stored in the DB, get_FIELD_url now returns a URL that always has the current date interpolated into it. For any file uploaded before today, that will be a broken link. This is a showstopper bug; please revert [7986] as quickly as possible. nobody carljm   0 0 0 0 0 0
Powered by Datasette · Queries took 1.552ms