Last active
August 29, 2015 14:18
-
-
Save neuman/7506979e7df94837c9b0 to your computer and use it in GitHub Desktop.
CarteBlanche Codementor Snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.contrib.auth import authenticate, login, logout | |
| class UserLogoutView(TemplateView): | |
| template_name = 'whatever' | |
| def get(self, request, **kwargs): | |
| #if the user has no payment methods, redirect to the view where one can be created | |
| logout(self.request) | |
| return HttpResponseRedirect(reverse(viewname='location_list', current_app='core')) | |
| #use verb to reverse a url for a given instance | |
| VerbClass(model_instance).get_url() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment