Hello,
I am studying on django tutorials 3 and 4.
I have polls/model.py is as follows
import datetime
from django.utils import timezone
from django.db import models
# Create your models here.
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
def was_published_recently(self):
return self.pub_date >=timezone.now() - datetime.timedelta(days=1)
was_published_recently.admin_order_field ='pub_date'
was_published_recently.boolead = True
was_published_recently.short_description ='Published recently?'
I have templates/index.html as follows
{% if latest_poll_list %}
<ul>
{% for poll in latest_poll_list %}
<li><a href="/polls/{{ poll.id }}/">{{ poll.question }}</a></li>
{% endfor %}
</ul>
{% else %}
<p>No polls are available.</p>
{% endif %}
But I cannot see the choice label, {{ poll.question }} is empty as follows
<h1>Naber?</h1>
<form action="/polls/1/vote/" method="post">
<div style='display:none'><input type='hidden' name='csrfmiddlewaretoken'
value='TVAZEa8exAcHGIrOM5QB5PgxhMpzWJBJ' /></div>
<input type="radio" name="choice" id="choice1" value="1" />
<label for="choice1"></label><br />
<input type="radio" name="choice" id="choice2" value="2" />
<label for="choice2"></label><br />
<input type="radio" name="choice" id="choice3" value="3" />
<label for="choice3"></label><br />
<input type="submit" value="Vote" />
</form>
How can I solve this?
Thank you.
--
SEYFULLAH TIKIÇ
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.