This is intended behavior and documented in the generic view documentation here: http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-date-based-archive-year It states that this view raises a 404, when the queryset is empty, so the resulting page basically is considered empty and therefore a 404 error is appropriate.
You need to take the optional argument 'allow_empty' into consideration, I quote from the docs: "allow_empty: A boolean specifying whether to display the page if no objects are available. If this is False and no objects are available, the view will raise a 404 instead of displaying an empty page. By default, this is False." So you might want to use allow_empty=True in your view to prevent raising 404s on empty querysets. Regards, Reiner On Apr 4, 4:20 pm, dls <daniel.si...@gmail.com> wrote: > Ok, it turns out that the "archive year" generic view throws a 404 > error if the querset commands result in an empty set. Through testing > I discovered that my development server database works fine because > the queryset returns values, but the live database throws a 404 > because it returns with an empty set. This is very strange because the > live database is nothing more than the development db with more > information in the fields - I don't see any reason why one should > error out and not the other. > > For testing, I called these commands on both databases: > > key: > 1 = development database (small, not many records) > 2 = live database (larger, but still not huge - should be identical to > the dev db) > > > python manage.py dbshell > > select * from blog_post; > > results: > db1: three blog entries are returned > db2: seven blog entries are returned (as I have added four) > > > python manage.py shell > > from blog.models import Post > > temp = Post.objects.all() > > temp #just to print > > results: > db1: three blog entries are returned > db2: an empty set [] is returned > > I understand that objects.all() is the same as "select * from > blog_post", so the fact that one works while the other does not is > further confusing. > > I would upload the databases, but google groups doesn't seem to > provide that functionality. Any suggestions as to where I can upload > files temporarily? > > Thanks! > > -dls --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---