This is regarding Django tutorial - Part 2 http://docs.djangoproject.com/en/dev/intro/tutorial02/
In the section to change the template for admin page, I tried to change this section in the base_site.html page.
{% trans 'Django's administration' %}When I add the apostrophe and s, I ge the error that - TemplateSyntaxError at /admin/ only option for 'trans' is 'noop'
Why is it so? I thought I should be able to change the site's name. I tried using double quotes and escape sequence also, but it did not work.
I tried using double quotes and escape sequence also, but it did not work.
That is definitely the problem. That is the only problem that the error message specifies!
Are you positive there are no other places where you've done that?
It should be:
{% trans "Django's administration" %}
That error messages only exists for the tag "trans" and appears if there is any other argument in the tag that is not noop.
The problem is the second single-quote:
{% trans 'Django's administration' %}
Django is treating everything after it as an argument. As the only argument it accepts is noop, this is causing an error.
One way to get around it is to do as Yuji 'Tomita' Tomita suggested, and enclose your translation string in double-quotes.
Another way is to use the blocktrans tag:
{% blocktrans %}
Django's administration
{% endblocktrans %}
As you're not using quotes to denote text which needs to be translated, this won't run into the same issue as the trans tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With