6👍
Django introduced a messages app in 1.2 (release notes), and deprecated the old user messages API.
In Django 1.4, the old message_set API has been removed completely, so you’ll have to update your code. If you follow the messages docs, you should find it pretty straight forward.
4👍
Add
from django.contrib import messages
And then
def foo(request):
messages.add_message(request, messages.INFO, "Your message.")
- [Django]-Use Django-Storages with IAM Instance Profiles
- [Django]-Upgrading to django 1.11 many to many column not found
- [Django]-IPN delivery failed. HTTP error code 403: Forbidden
- [Django]-Django sites framework and Heroku
- [Django]-How to train a Keras model in Django: weak reference to 'gevent._local.local' object error
0👍
What is in your INSTALLED_APPS
in your settings.py
?
Do you have 'django.contrib.messages',
included there?
Something like:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
...
0👍
From Django 1.4 docs
To enable message functionality, in settings.py do the following:
Edit the MIDDLEWARE_CLASSES
setting and make sure it contains
'django.contrib.messages.middleware.MessageMiddleware'
If you are using a storage backend that relies on sessions (the default), django.contrib.sessions.middleware.SessionMiddleware
must be enabled and appear before MessageMiddleware
in your MIDDLEWARE_CLASSES
.
Edit the TEMPLATE_CONTEXT_PROCESSORS
setting and make sure it contains
'django.contrib.messages.context_processors.messages'
Add 'django.contrib.messages'
to your INSTALLED_APPS
setting
As far as django-avatar is concerned. Use the master files found here: https://github.com/chadpaulson/django-avatar/tree/master/avatar
- [Django]-Custom django-admin commands – AttributeError: 'Command' object has no attribute 'stdout'
- [Django]-Django aggregation across multiple tables in ModelAdmin queryset
- [Django]-Crontab is running but still not executing command Django
- [Django]-Howto use django regular inheritance in models and forms
- [Django]-Django serving each app separately in each its port