django-native-tags icon indicating copy to clipboard operation
django-native-tags copied to clipboard

Loading tags from the module they are defined

Open orientalperil opened this issue 14 years ago • 0 comments

In django-native-tags / native_tags / registry.py, tag modules are loaded and searched for tags using django-native-tags' interface. When such tags are found they are registered in an internal tag library (native_tags.registry.register). In django-native-tags / native_tags / templatetags / native.py, the internal tag library is used to register the tags in a Django template library.

The consequence of this is that to use tags using the django-native-tags interface, you must put {% load native %} in your template file. This concerns me for 2 reasons:

  1. There is only only tag library/namespace for tags using this interface. I may have many tags use django-native-tags and they must all be loaded from the same name.
  2. It is not as clear because the tag registration is done in a place that is separate from its definition. This is very different from the normal Django expectation.

Would it be possible to change this so that tags can be loaded in the usual Django pattern? By this I mean that if I define a tag a_tag in my_app.templatetags.my_tags that I can load it template with {% load my_tags %}.

This would require breaking NativeNode's reliance on native_tags.registry.register.

orientalperil avatar Oct 05 '11 21:10 orientalperil