#15252: get_static_url in static templatetags ------------------------------------------------------+--------------------- Reporter: ohardy | Owner: nobody Status: new | Milestone: Component: django.contrib.staticfiles | Version: SVN Resolution: | Keywords: Triage Stage: Accepted | Has patch: 0 Needs documentation: 1 | Needs tests: 1 Patch needs improvement: 1 | ------------------------------------------------------+--------------------- Changes (by jezdez):
* needs_better_patch: 0 => 1 * stage: Design decision needed => Accepted * needs_tests: 0 => 1 * needs_docs: 0 => 1 Comment: Having given this a bit more thought, I'm convinced this is a useful. There are a few edge cases though: 1. The docs need to carefully explain how the storage influences the result of this template tag, e.g. signed URLs, increased latency with remote storage backends etc. It's usually also a pretty advanced topic, so we need to make sure this won't confuse beginners. 2. !FileFields and !ImageFields can be passed different storage backends, which is why the template tag doesn't completely apply to MEDIA_URL. It should probably check whether it's passed a file instance or a string, e.g. {{{ @register.simple_tag() def get_media_url(file_or_path): if isinstance(file_or_path, UploadedFile): return file_or_path.url return storage.url(file_or_path) }}} -- Ticket URL: <http://code.djangoproject.com/ticket/15252#comment:4> Django <http://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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.