Opened 10 years ago

Closed 10 years ago

#24192 closed Cleanup/optimization (wontfix)

Deprecate django.templatetags.static

Reported by: Kristian Glass Owned by: nobody
Component: Core (Other) Version: dev
Severity: Normal Keywords:
Cc: julian@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

As far as I can see, since django.contrib.staticfiles was merged in, there's no reason to use django.templatetags.static and plenty of reasons not to (e.g. it makes assumptions about the existence of STATIC_URL)

The fact it provides a tag of the same name as the "correct" tag from staticfiles doesn't help either.

Could it be deprecated?

(And if I wanted to follow up with an accompanying PR, should I be using RemovedIn110Warning or RemovedIn20Warning (the latter of which has several instances, but surprises me slightly)

Change History (5)

comment:1 by Kristian Glass, 10 years ago

Ok, RemovedIn20Warning, thanks apollo13

comment:2 by Kristian Glass, 10 years ago

Ah, I've just noticed this is used by admin; this PR is getting more fun!

comment:3 by Kristian Glass, 10 years ago

So django.contrib.admin.templatetags.admin_static tries to use django.contrib.staticfiles.templatetags.staticfiles if the app's there, otherwise falls back to django.templatetags.static.

Can anyone provide guidance as to "improved" behaviour there please? Is there any kind of policy against apps from contrib depending on one another? Is it reasonable for d.c.admin to assume/require d.c.staticfiles? If the latter, can anyone point me to an existing example so I can crib from its mechanisms please? - d.c.auth depends on d.c.sessions, will crib appropriately

Last edited 10 years ago by Kristian Glass (previous) (diff)

comment:4 by Julian Wachholz, 10 years ago

Cc: julian@… added

comment:5 by Tim Graham, 10 years ago

Component: UncategorizedCore (Other)
Resolution: wontfix
Status: newclosed

I don't see much advantage here vs. the pain this is likely to cause (force everyone to use contrib.staticfiles and {% load static %} in their templates. The documentation points users in the direction IMO. There has been some talk of "if we did it again, static files might have been better in core, rather than contrib", but I'm not sure if that's something that's worth changing at this point. See also #18942. Feel free to raise the issue on the DevelopersMailingList or reopen if you think I've missed something here.

Note: See TracTickets for help on using tickets.
Back to Top