feincms / feincms-elephantblog

A blog for FeinCMS
feinheit.ch/labs/
BSD 3-Clause "New" or "Revised" License
42 stars 38 forks source link

Fixes #14: With timezone support enabled, links may lead to 404 pages #17

Closed uruz closed 12 years ago

uruz commented 12 years ago

I've added a test application and two tests. Without changes in models.py one of two fail.

uruz commented 12 years ago

I've also filed a ticket against django: https://code.djangoproject.com/ticket/18794

uruz commented 12 years ago

Yes, using default time zone (one that is defined by settings.TIME_ZONE) is another option... It would be easy to change from UTC to that. Should I do that?

sbaechler commented 12 years ago

Thank you for the patch. I tried running your tests but it already failed on the first test. I wasn't able to find the method '_make_date_lookup_arg' either in the class based views, or where this method is called.

The failure was on line 40: Got a 404 instead of a 200 response.

Could you please explain how it is supposed to work?

uruz commented 12 years ago

I run test suite with the python manage.py test --settings=elephantblog.tests.testapp.settings elephantblog on django trunk. Tests may fail at other conditions, what is yours?

sbaechler commented 12 years ago

I ran it as application content with Django 1.4 and FeinCMS 1.6.

uruz commented 12 years ago

That's weird, i've tried to run tests with Django 1.4 and FeinCMS 1.6 and they passed (but Django 1.4 does not have _make_date_lookup_arg method)

sbaechler commented 12 years ago

I changed your code a bit, using make_naive for the permalink, and now the tests pass. I also added support for django 1.4.

https://github.com/sbaechler/feincms-elephantblog/commit/91a4fb856a28753c4ff3f1991f8ce30b83540194

sbaechler commented 12 years ago

Thank you for your help on this. I noticed that Django changed the class based views a lot in Trunk and timezone support will be easier there. The current fix is quite ugly.

I decided to go for UTC with the permalinks. The only reason for this instead of settings.TIME_ZONE is, that the URLs stay the same even if the server changes the default time zone.