Okay, now I'm thinking this has to do with date fields being either blank=True or null=True or maybe both. I have another model where the date field is blank and nullable, and there are instances in the database where the field value is Null, and doing a dates() query on that produces an error. It seems like the error is arising from the None type getting through to the DateQuerySet initialization, but looking at the dates() query, it seems like it's supposed to be filtering the queryset for None values, might that not be happening?
Can anyone re-create this? Is this a bug or am I using it incorrectly? Here's the traceback for the model with a few Null/None values for the date field. My other model (date field is blank=True, null=True, but there are no Null date values in the database), raises no errors, but simply returns an empty DateQuerySet. Traceback (most recent call last): File "<console>", line 1, in <module> File "/Library/Python/2.5/site-packages/django-trunk/django/db/ models/query.py", line 43, in __repr__ return repr(list(self)) File "/Library/Python/2.5/site-packages/django-trunk/django/db/ models/query.py", line 55, in __len__ self._result_cache.extend(list(self._iter)) File "/Library/Python/2.5/site-packages/django-trunk/django/db/ models/sql/subqueries.py", line 357, in results_iter date = typecast_timestamp(str(date)) File "/Library/Python/2.5/site-packages/django-trunk/django/db/ backends/util.py", line 67, in typecast_timestamp if not ' ' in s: return typecast_date(s) File "/Library/Python/2.5/site-packages/django-trunk/django/db/ backends/util.py", line 52, in typecast_date return s and datetime.date(*map(int, s.split('-'))) or None # returns None if s is null ValueError: invalid literal for int() with base 10: 'None' 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 -~----------~----~----~----~------~----~------~--~---