Hello all ... It´s my first post on here... So, i´ve got a little problem when i follow the instructions to create an app on Django. I´ve created the Poll like the tutorial, and it´s all ok . But when i try to put this on a view to show in a template i´ve got the problem.
I´m from Brazil so, my models, views and templates can be in portuguese but i think that´s not a problem ;) Let´s see... Below the Models File ### #Poll class enquete(models.Model): pergunta = models.CharField('Pergunta', max_length = 50) habilitada = models.BooleanField('Habilitada', default = True) dataCriacao = models.DateField(verbose_name = 'Criada em', auto_now = True, auto_now_add = True) def __unicode__(self): return self.pergunta class Meta: verbose_name = 'Enquete' verbose_name_plural = 'Enquetes' #Choice class respostaEnquete(models.Model): idPergunta = models.ForeignKey(enquete) opcao = models.CharField(verbose_name = u'Opção', max_length = 50) votos = models.IntegerField(verbose_name = u'Número de votos', default = 0) def __unicode__(self): return self.opcao class Meta: verbose_name = 'Resposta da enquete' verbose_name_plural = 'Respostas das enquetes' ## Now, the views file # -*- coding: utf-8 -*- from django.http import HttpResponse from django.shortcuts import render_to_response from Teccom.conteudo.models import * def noticiasIndex(request): #Pegando as notícias ... noticias = noticia.objects.filter(habilitada = True).all() #Getting the notices ... lista = enquete.objects.all() # getting the poll return render_to_response('principal.html', locals()) ## and now, the Template file ;) <div id="news"> {% for enquete in lista %} <h1>{{ enquete.pergunta }}</h1> {% if error_message %}<p><strong>{{ error_message }}</strong></ p>{% endif %} <form action="/enquete/{{ enquete.id }}/vote/" method="post"> {% for resposta in enquete.resposta_set.all %} <input type="radio" name="resposta" id="resposta {{ forloop.counter }}" value="{{ resposta.id }}" /> <label for="resposta{{ forloop.counter }}"> {{ resposta.opcao }}</label><br /> {% endfor %} <input type="submit" value="Votar" /> </form> {% endfor %} </div> Like i said, i can´t get the options ( choices ) ... Only the poll title apears .. Can anoyone help me? Thanks and sorry about my english .... --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---