Python django.contrib.messages.utils.get_level_tags() Examples
The following are 3
code examples of django.contrib.messages.utils.get_level_tags().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.contrib.messages.utils
, or try the search function
.
Example #1
Source File: base.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def enable(self): super().enable() # LEVEL_TAGS is a constant defined in the # django.contrib.messages.storage.base module, so after changing # settings.MESSAGE_TAGS, update that constant also. self.old_level_tags = base.LEVEL_TAGS base.LEVEL_TAGS = utils.get_level_tags()
Example #2
Source File: base.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def enable(self): super().enable() # LEVEL_TAGS is a constant defined in the # django.contrib.messages.storage.base module, so after changing # settings.MESSAGE_TAGS, update that constant also. self.old_level_tags = base.LEVEL_TAGS base.LEVEL_TAGS = utils.get_level_tags()
Example #3
Source File: styleguide.py From Inboxen with GNU Affero General Public License v3.0 | 4 votes |
def styleguide(request): now = timezone.now() + timedelta(-1) domain = mock.Mock(domain="example.com") # create a bunch of mocked inboxes inboxes = [ mock.Mock( inbox="qwerty", domain=domain, get_bools_for_labels=(("new", False),), last_activity=now, form=InboxEditForm(request), ), mock.Mock( inbox="qwerty", domain=domain, get_bools_for_labels=(("disabled", True),), last_activity=now, form=False, ), mock.Mock( inbox="qwerty", domain=domain, get_bools_for_labels=(("new", True), ("pinned", True)), last_activity=now, form=False, ), ] # emails emails = [ mock.Mock( inbox=inboxes[0], get_bools_for_labels=(("important", True),), received_date=now, ), mock.Mock( inbox=inboxes[0], get_bools_for_labels=(("important", False),), received_date=now, ), ] # attachments attachments = [ mock.Mock(id=0, filename=("a" * 100), content_type="blah/blah", get_children=[]), mock.Mock(id=0, filename="a", content_type=None, get_children=[]), ] context = { "inboxes": inboxes, "emails": emails, "attachments": attachments, "form": Form(), "message_types": [(k, get_level_tags()[v]) for k, v in DEFAULT_LEVELS.items() if k != 'DEBUG'], } return TemplateResponse(request, 'inboxen/styleguide.html', context)