Re: Admin behavior: what is errors.items in change_form.html?

2008-11-04 Thread Karen Tracey
On Tue, Nov 4, 2008 at 7:36 AM, nazar <[EMAIL PROTECTED]> wrote:

>
> Now I got it!!!
>
> I had TEMPLATE_STRING_IF_INVALID = 'TEMPLATE_STRING_IF_INVALID'
>
> So that 'items' was rendered as 'TEMPLATE_STRING_IF_INVALID' (and I
> saw it clearly). And I met the bug, bacause gettext was unable to use
> it as int parameter.
>
> Now I cleared this: TEMPLATE_STRING_IF_INVALID = '' and bug
> disappeared.
>

Yes, the admin rather relies on TEMPLATE_STRING_IF_INVALID being empty.
See:

http://docs.djangoproject.com/en/dev/ref/templates/api/#invalid-template-variables
http://code.djangoproject.com/ticket/3579

However, this particular case is a genuine bug in the admin templates.  Even
with an empty TEMPLATE_STRING_IF_INVALID, the wrong message is displayed
when there is only one error to be corrected on the page.   I've opened a
ticket to get that (and anywhere else in the admin that this construct is
used) fixed:

http://code.djangoproject.com/ticket/9514

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin behavior: what is errors.items in change_form.html?

2008-11-04 Thread nazar

Now I got it!!!

I had TEMPLATE_STRING_IF_INVALID = 'TEMPLATE_STRING_IF_INVALID'

So that 'items' was rendered as 'TEMPLATE_STRING_IF_INVALID' (and I
saw it clearly). And I met the bug, bacause gettext was unable to use
it as int parameter.

Now I cleared this: TEMPLATE_STRING_IF_INVALID = '' and bug
disappeared.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Admin behavior: what is errors.items in change_form.html?

2008-11-03 Thread Karen Tracey
On Mon, Nov 3, 2008 at 2:16 PM, nazar <[EMAIL PROTECTED]> wrote:

>
> I met some unusual behavior in my project in admin change form with
> inlines. There is code in template change_form.html:
>
> {% blocktrans count errors.items|length as counter %}Please correct
> the error below.{% plural %}Please correct the errors below.{%
> endblocktrans %}
>
> Template can't evaluate 'errors.items' object.
>
> As I saw in code there is no "items" attribute, method or dictionary
> key in 'errors'.
>
> Can anybody explain what is this and why it works?
>
>
Looks like a bug.  The '.items' part just shouldn't be there.  As it is no
matter whether there is a single or multiple errors the plural message is
displayed.  Removing the .items (errors is a list type, not a dictionary)
fixes things so that the singular message is displayed when there is only
one error to be fixed.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Admin behavior: what is errors.items in change_form.html?

2008-11-03 Thread nazar

I met some unusual behavior in my project in admin change form with
inlines. There is code in template change_form.html:

{% blocktrans count errors.items|length as counter %}Please correct
the error below.{% plural %}Please correct the errors below.{%
endblocktrans %}

Template can't evaluate 'errors.items' object.

As I saw in code there is no "items" attribute, method or dictionary
key in 'errors'.

Can anybody explain what is this and why it works?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---