Thanks Adi, but that's not it. I've got other models in this app where  
plain old Model.objects.dates() works just fine, and besides, your  
longer version still doesn't work with my Appearance model :)

I'm pasting the model definition below, just in case anything leaps  
out at anyone. At first I thought it was because the underlying date- 
based db column was actually called 'date', and that might be  
clobbering some built-in, but now I see I've got other models doing  
the same thing on a 'date' field, and it works fine...


class Appearance(models.Model):
     venue = models.CharField(max_length=100)
     extraInfo = models.TextField(db_column="address")
     city = models.CharField(max_length=80)
     country = models.CharField(max_length=50, default='United States')
     app_date = models.DateTimeField("Appearance date",blank=True,  
null=True, db_column="date")
     link = models.URLField(verify_exists=False, blank=True)

     def is_future(self):
         return self.app_date > datetime.now()

     class Admin():
         list_filter = ('app_date','country')

     class Meta():
         ordering = ['-app_date']

     def __unicode__(self):
         return "%s: %s/%s, %s" % (self.venue, self.app_date.month,  
self.app_date.day,self.app_date.year)

     def get_absolute_url(self):
         return "/appearances/%s/#%s" % (self.app_date.year, self.pk)


On May 14, 2008, at 3:30 PM, Adi Jörg Sieker wrote:

> Hi Eric,
>
> On 14.05.2008, at 03:49, Eric Abrahamsen wrote:
>
>> app_years = Appearance.objects.dates('app_date','year')
>
> I don't know if it makes a difference and I'm new to django, but  
> I've used the dates method like so:
>
> app_years = Appearance.objects.all().dates('app_date','year')
>
> and it works like a charm
>
> adi
>
> --
> Adi J. Sieker         mobile: +49 - 178 - 88 5 88 13
> Freelance developer   skype:  adijsieker
> SAP-Consultant        web:    http://www.sieker.info/profile
>                       openbc: https://www.openbc.com/hp/AdiJoerg_Sieker/
>
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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