Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Using new messages framework within built-in admin ? [RSS Feed]

#1 May 21, 2010 14:47:01

Nicolas S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Using new messages framework within built-in admin ?


Hi,

For some actions I made from the Django built-in admin, I would like
to improve the user experience with a better distinction between
sucess & error messages.

With Django 1.1.x, I used to use Model admin actions with
statements like :

modeladmin.message_user(request, "%s successfully marked as
published." % message_bit)

With the new 1.2 version, I was about to use the messages framework
and the messages.success() / messages.error() shortcuts to provide a
better experience. I now have in my code :

messages.success(request, "%s successfully marked as published." %
message_bit)

So running my own admin/base.html file, I replaced the messages
section by the example provided in the doc :

{% if messages %}
<ul class="messages">
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}
>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}

What happens is that messages.tags is empty.If I understand well the
doc, I should have an "error" or "success" tags for my error/success
messages.

What did I miss ? Or is it a bug ? Or the admin do not use yet the new
message framework ?

http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/#actions-as-modeladmin-methodshttp://docs.djangoproject.com/en/1.2/ref/contrib/messages/#ref-contrib-messages--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 May 27, 2010 11:49:36

Nicolas S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Using new messages framework within built-in admin ?


Nobody on this issue ?

On 21 mai, 15:46, Nicolas Steinmetz <nsteinm...@gmail.com> wrote:
> Hi,
>
> For some actions I made from the Django built-in admin, I would like
> to improve the user experience with a better distinction between
> sucess & error messages.
>
> With Django 1.1.x, I used to use Model admin actions with
> statements like :
>
>     modeladmin.message_user(request, "%s successfully marked as
> published." % message_bit)
>
> With the new 1.2 version, I was about to use the messages framework
> and the messages.success() / messages.error() shortcuts to provide a
> better experience. I now have in my code :
>
>     messages.success(request, "%s successfully marked as published." %
> message_bit)
>
> So running my own admin/base.html file, I replaced the messages
> section by the example provided in the doc :
>
> {% if messages %}
> <ul class="messages">
>     {% for message in messages %}
>     <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message
> }}</li>
>
>     {% endfor %}
> </ul>
> {% endif %}
>
> What happens is that messages.tags is empty.If I understand well the
> doc, I should have an "error" or "success" tags for my error/success
> messages.
>
> What did I miss ? Or is it a bug ? Or the admin do not use yet the new
> message framework ?
>
> http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/#actio...
> http://docs.djangoproject.com/en/1.2/ref/contrib/messages/#ref-contri...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group
> athttp://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Jan. 3, 2011 18:51:02

rahul j.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Using new messages framework within built-in admin ?


anyone on this ?

How to display error messages ?

On Thu, May 27, 2010 at 3:49 AM, Nicolas Steinmetz <nsteinm...@gmail.com>wrote:

> Nobody on this issue ?
>
> On 21 mai, 15:46, Nicolas Steinmetz <nsteinm...@gmail.com> wrote:
> > Hi,
> >
> > For some actions I made from the Django built-in admin, I would like
> > to improve the user experience with a better distinction between
> > sucess & error messages.
> >
> > With Django 1.1.x, I used to use Model admin actions with
> > statements like :
> >
> > modeladmin.message_user(request, "%s successfully marked as
> > published." % message_bit)
> >
> > With the new 1.2 version, I was about to use the messages framework
> > and the messages.success() / messages.error() shortcuts to provide a
> > better experience. I now have in my code :
> >
> > messages.success(request, "%s successfully marked as published." %
> > message_bit)
> >
> > So running my own admin/base.html file, I replaced the messages
> > section by the example provided in the doc :
> >
> > {% if messages %}
> > <ul class="messages">
> > {% for message in messages %}
> > <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{
> message }}</li>
> >
> > {% endfor %}
> > </ul>
> > {% endif %}
> >
> > What happens is that messages.tags is empty.If I understand well the
> > doc, I should have an "error" or "success" tags for my error/success
> > messages.
> >
> > What did I miss ? Or is it a bug ? Or the admin do not use yet the new
> > message framework ?
> >
> >
>http://docs.djangoproject.com/en/dev/ref/contrib/admin/actions/#actio...
> >
>http://docs.djangoproject.com/en/1.2/ref/contrib/messages/#ref-contri...
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> > For more options, visit this group athttp://
> groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » Using new messages framework within built-in admin ? [RSS Feed]

Board footer

Moderator control

Enjoy the 20th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support