#13170 closed (fixed)
messages set_level AttributeError
| Reported by: | dm | Owned by: | nobody |
|---|---|---|---|
| Component: | Contrib apps | Version: | dev |
| Severity: | Keywords: | messages, set_level, get_level | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I have the following views.py file:
from django.contrib import messages
from django.shortcuts import render_to_response
from django.template import RequestContext
def main(request):
messages.set_level(request, messages.DEBUG)
messages.success(request, 'yo')
return render_to_response('main.html',
context_instance=RequestContext(request))
When I use this view, I get the following:
AttributeError at / 'module' object has no attribute 'set_level'
Here is the patch to fix this problem:
Index: contrib/messages/api.py
===================================================================
--- contrib/messages/api.py (revision 12825)
+++ contrib/messages/api.py (working copy)
@@ -4,6 +4,7 @@
__all__ = (
'add_message', 'get_messages',
+ 'get_level', 'set_level',
'debug', 'info', 'success', 'warning', 'error',
)
Attachments (1)
Change History (6)
comment:1 by , 16 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:2 by , 16 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:3 by , 16 years ago
| Owner: | changed from to |
|---|---|
| Status: | assigned → new |
| Triage Stage: | Accepted → Ready for checkin |
comment:4 by , 16 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Yep, as documented here it should made be available.