Malcolm Tredinnick wrote:
> On Sat, 2007-07-07 at 14:59 -0500, Carl Karsten wrote:
>> # views.py
>> class Event(models.Model):
>>      title = models.CharField(maxlength=255)
>>      eventdate = models.DateField()
>>      description = models.TextField(blank=True)
>>      def __str__(self):
>>          return "%(ed)s  %(t)s" % {'t':self.title, 'ed':self.eventdate }
>>
>> # models.py
>>      # get Events from the DB that are in the specified month.
>>      object_list = 
>> Event.objects.filter(eventdate__range=(dates[0][0],dates[-1][-1]))
>>
>>
>> template:
>> month_index.html
>>
>> object_list: {{ object_list }} object_list.0: {{ object_list.0 }}
>>
>>
>> brows it:
>> renders:  object_list: [             ] object_list.0: 2007-07-07  up
>>
>> Why does {{object_list}} render an empty list ?
> 
> The usual way to debug these problems is to work out what is going on at
> the command line.

heh - I just suggested that to someone having problems on IRC.  maybe I need to 
take my own advice sometime :)

> I suspect if you do that, you'll find that the
> object_list looks like [<Event: ...>]. So just dumping it into the HTML
> will lead to your browser interpreting the angle brackets as an HTML
> element, and just swallowing it up, since it's not a valid element.
> 
> Often, if something isn't rendering as you expect, view the HTML source
> to check what has really been returned.

yup:

object_list: [<event: 2007-07-07="" up="">] object_list.0: 2007-07-07  up

Thanks

Carl K

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to