db 쿼리의 목록으로 hello.html
에 선택 메뉴를 생성하려고합니다. 내 models.py
db 쿼리를 사용하는 장고 charfield 모델
:
class hello(models.Model):
q = """
SELECT * FROM ZONAS
WHERE cod_zona = 1
"""
db.query(q)
nome = db.query(q)
title = models.CharField(max_length=3, choices=nome)
def __unicode__(self):
return self.name
및 my views.py
: 나는에 갇혀 있어요
def contato(request):
form = hello()
return render_to_response(
'hello.html',
locals(),
context_instance=RequestContext(request),
)
def hello_template(request):
form = hello()
t = get_template('hello.html')
html = t.render(Context({'name' : nome}))
return HttpResponse(html)
: ERROR testApp.hello: "title": "choices" should be a sequence of two-tuples.
친절하게 감사 어떤 도움.