Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#20417 closed Uncategorized (fixed)

Server restart needed to load new tags and filters

Reported by: Katya <internum.odium@…> Owned by: anonymous
Component: Documentation Version: 1.5
Severity: Normal Keywords:
Cc: timograham@…, zbigniew@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: yes UI/UX: no

Description

https://docs.djangoproject.com/en/1.5/howto/custom-template-tags/

It would be nice to mention that to have new tags and filters loaded one should restart the server.

Attachments (1)

20417-Server restart needed to load new tags and filters (596 bytes) - added by DjangoPanngo 3 years ago.
Suggested addition to the documentation.

Download all attachments as: .zip

Change History (19)

comment:1 Changed 3 years ago by Baptiste Mispelon

Easy pickings: set
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

Hi,

I agree, this would be a welcome addition.

comment:2 Changed 3 years ago by Daniele Procida

Owner: changed from nobody to Daniele Procida
Status: newassigned

I have tentatively reserved this ticket for first-time committers who take part in the Don't be afraid to commit workshop at the DjangoCon Europe 2013 sprints on 18th and 19th May.

If you want to tackle this ticket before then, please don't let the fact that it's assigned to me stop you. Feel free to re-assign it to yourself and do whatever you like to it.

comment:3 Changed 3 years ago by boromil

Owner: changed from Daniele Procida to anonymous

comment:4 Changed 3 years ago by DjangoPanngo

Owner: changed from anonymous to DjangoPanngo

comment:5 Changed 3 years ago by Krzysztof Malinowski <boromil@…>

Owner: changed from DjangoPanngo to anonymous

Changed 3 years ago by DjangoPanngo

Suggested addition to the documentation.

comment:6 Changed 3 years ago by DjangoPanngo

Please review and advise if the layout/content/placement need to change.

comment:7 Changed 3 years ago by DjangoPanngo

Triage Stage: AcceptedReady for checkin

comment:8 Changed 3 years ago by Krzysztof Malinowski <boromil@…>

Sorry about taking this ticket off you DjangoPanngo - I've tried before to sign it to myself but it only showed anonymous... anyway I also submitted a proposition through githubs pull request. Your look good to so let someone else decide.

comment:9 Changed 3 years ago by DjangoPanngo

Triage Stage: Ready for checkinAccepted

Moving this back to accepted because it's missing mentioning of filters.

comment:10 Changed 3 years ago by boromil

Triage Stage: AcceptedReady for checkin

comment:11 Changed 3 years ago by boromil

This is the updated branch with the corrected info.

comment:12 Changed 3 years ago by Tim Graham

Cc: timograham@… added

I'm not sure exactly what requires reloading the server? I was testing with the staticfiles template tag and got an error "TemplateSyntaxError: Invalid block tag: 'static'". I then added "{% load staticfiles %}" to the template and didn't reload the development server, but the error was resolved when refreshing the page.

comment:13 Changed 3 years ago by Tim Graham

Has patch: set
Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

comment:14 Changed 3 years ago by Zbigniew Siciarz

Cc: zbigniew@… added

It's not about adding new {% load %} tags to the template. The reload is necessary when you add new Python module containing tags or filters definitions to the templatetags subdirectory of an app.

comment:15 Changed 3 years ago by Tim Graham

Tried that as well. Added {% load foo %} to a template without that module in myapp.templatetags and got the error:

TemplateSyntaxError:
  'foo' is not a valid tag library: Template library foo not found,
  tried django.templatetags.foo,myapp.templatetags.foo,etc.

Then added foo.py to myapp.templatetags and refreshed the page without reloading the server and the filter in "foo" worked.

comment:16 Changed 3 years ago by Carl Meyer

The problem occurs only when an app in INSTALLED_APPS does not have a templatetags submodule at all, and then one is added while the server is running; Django won't see it unless you restart the server.

Last edited 3 years ago by Carl Meyer (previous) (diff)

comment:17 Changed 3 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In a46a399534c26abd3f4984149b820f34869d6b74:

Fixed #20417 - Noted that a server restart is required to load new templatetag modules.

Thanks Katya for the suggestion.

comment:18 Changed 3 years ago by Tim Graham <timograham@…>

In 9ed2121eca0d4543dd665d7c5a3015beaee28eb4:

[1.5.x] Fixed #20417 - Noted that a server restart is required to load new templatetag modules.

Thanks Katya for the suggestion.

Backport of a46a399534 from master

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