Opened 11 years ago
Closed 11 years ago
#21421 closed New feature (fixed)
Expose level tag (debug, info, warning) on messages
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | contrib.messages | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Baptiste Mispelon | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Messages in the messages framework have a level, like debug, info or warning. It would be nice if this level was accessible in the view, so that it can be used in a class name. For example, Twitter Bootstrap has
an alert-info class. This class could be added to the message using class="alert-{{ message.level_tag }}".
The existing extra_tags functionality does not provide for this, because the level_tag is on the end. When using class="alert-{{ message.extra_tags }}" it will only work when no extra tags are given.
I have made a pull request for this here: https://github.com/django/django/pull/1891
Change History (3)
comment:1 by , 11 years ago
Cc: | added |
---|---|
Has patch: | set |
Needs documentation: | set |
Patch needs improvement: | set |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 11 years ago
Patch needs improvement: | unset |
---|
I have modified the code according to your remarks and I added some documentation. Any feedback on the documentation is welcome.
comment:3 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Hi,
This looks like an interesting addition.
The pull request looks good but it's lacking documentation. The new feature should be described in the messages framework documentation and a release note should be added for the 1.7 release.
I'm adding the "patch needs improvement" flag for this reason. You can remove it when you update the pull request.
Thanks.