2013-02-19 4 views

답변

0

나는 당신이 두 문장에 ififequal을 분리 할 필요가 있다고 생각

{% if myList|length and myValue == 'somestring' %} 
    blah blah 
{% endif %} 
12

이런 식으로 뭔가해야합니다 :

+0

너와 같습니다. 나는 내가 파티에 늦은 것 같아. – arulmr

+0

@arulmr 2 분 늦었지만 한 표 앞두고 – kmerenkov

+0

미안 친구. 그게 우연의 일치 야. – arulmr

15

보십시오이 :

{% if myList|length and myValue == 'somestring' %} 
    blah blah 
{% endif %} 

boolean-operators의 사용법에 대한 django 문서를 참조하십시오. django 템플릿의 complex-expressions.

0

Django docs on boolean operators

and

{% if a == b or c == d and e %} 

것을 인식하고 나보다 더 우선 순위가 높은 순서가

{% if message %} 
    {% for post in message %} 
      {% if post.provider %} 
       .... 
      {% endif %} 
      {% if post.accept == True and post.provider %} 
       ... 
       ... 
      {% endif %} 
      ....You can add multiple if,elif, with Operators .... 
    {% endfor %} 
{% if message %} 
def posts_request(request): 
    message=ApplyPost.objects.filter(blah blah) 
    if message: 
     return render (request,'blah.html',{'message':message}) 
  1. blah.html

Should be something like this

  1. view.py

, 그 괄호는 가능하지 않습니다. 필요한 경우 중첩 된 블록을 사용하십시오.