danfairs / django-lazysignup

django-lazysignup is a package designed to allow users to interact with a site as if they were authenticated users, but without signing up. At any time, they can convert their temporary user account to a real user account.
BSD 3-Clause "New" or "Revised" License
410 stars 89 forks source link

Fix 'No module named simple' error when using Django 1.5 #23

Closed aguynamedben closed 11 years ago

aguynamedben commented 11 years ago

Hey Dan, this project is awesome, I'm finding it very useful.

I'm playing with Django 1.5 RC1 and the import in urls.py is failing.

According to https://docs.djangoproject.com/en/1.4/topics/generic-views/ it looks like since Django 1.3 the module django.views.generic.simple and its function direct_to_template were deprecated, and that module was finally removed in 1.5.

It's not the cleanest solution because I wanted to keep backwards-compatibility and reduce headache for people just trying to follow your awesome docs.

-Ben

danfairs commented 11 years ago

First of all, thanks for taking the time to check this out on 1.5. I hadn't got round to it yet!

I'm not keen on sniffing the Django version to be honest. If we were going down that route, you'd find you could just compare the version tuple directly. For instance even in this case, I think TemplateView is in Django 1.4, and we should use it there if we can.

Capability-based stuff is usually done in the rest of django by trying to import something, catching the ImportError if it happens, and doing something else. So I suspect the best bet is to try to import TemplateView (and use it if we can) and if not, fall back to direct_to_template.

And, we can just update the docs :)

Does that make sense?

Thanks again.

aguynamedben commented 11 years ago

Hey, sure yeah that all makes a lot of sense. Getting late where I am but I'll implement the things you're saying and update the pull request tomorrow or the next day, good call.

-Ben

huxley commented 11 years ago

Since TemplateView has been available since Django 1.3 does it make sense to have a fallback at all to direct_to_template ?

danfairs commented 11 years ago

True - and this is now all done anyway in 3308be4943bbebdb8b9749453c9912779e282888

ghost commented 10 years ago

hmm..