- September 2, 2011
- Not specified
- template filter app-label app-display
- 1 (after 1 ratings)
I have been wrestling with custom app labels and have come to the conclusion that this is the easiest workaround for the problem. Since I name most of my apps as Foo_Bar this makes them look a lot nicer. I just apply the filter to whatever app label and it fixes it.
If you need a more complex replacement, you could just have an if statement that looks for the full app label and replaces it with whatever you want.
1 2 3 4 5 6
@register.filter def niceLabel(label, arg=None): label = label.replace("_", " ") label = label.title() return label
More like this
- Rendering radio-buttons with icons instead of labels by jeverling 5 years, 1 month ago
- Subdirectory and subcontext include template tag with examples by t_rybik 5 years, 1 month ago
- Random Quotes by ferretsrule 7 years, 10 months ago
- Template filter for internal links in TextFields by bobtiki 5 months, 1 week ago
- Wiki-like markup for sub templates by luckystarr 7 years, 7 months ago