yes,you are right,i have noticed that,but now i have a new error:

i have this code in my template:

{% for action in actions %}
<li>
    <a href="{% url action.url_alias %}">{{ action.name_short }}</a>
</li>
{% endfor %}

the value of action.url_alias is  'user-edit' i.id host 'account' ,that's 
what i want value from table,i use django-hosts in my project,the error is 
that:

Reverse for ''user-edit' i.id host 'account'' with arguments '()' and 
keyword arguments '{}' not found. 0 pattern(s) tried: []

but when i use the value  'user-edit' i.id host 'account' directly in {%%} 
like this {% url  'user-edit' i.id host 'account' %},that's ok.
the i.id is one of another for loop's value.how can i do this,thanks for 
help.



On Monday, April 4, 2016 at 12:16:43 AM UTC+8, larry....@gmail.com wrote:
>
> On Sun, Apr 3, 2016 at 11:50 AM, 颜刚 <yang...@163.com <javascript:>> 
> wrote: 
> > 
> > 
> > i have this code in my template: 
> > 
> > {% for action in actions %} 
> > <li> 
> >     <a href="{% url {{ action.name}} %}">{{ action.name_short }}</a> 
> > </li> 
> > {% endfor %} 
> > 
> > but that's error: 
> > 
> > Exception Type: TemplateSyntaxError 
> > Exception Value: 
> > Could not parse the remainder: '{{' from '{{' 
> > 
> > i want to use var in {% url {{}} %},can i? 
> > anyone can help me ? 
>
> You don't need {{ }} around action.name if you're referencing it 
> inside of a {% %} block 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e48e99a5-e92b-4f79-b4ec-7b3abd10da72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to