Skip to content

Instantly share code, notes, and snippets.

@neuman
Last active August 29, 2015 14:18
Show Gist options
  • Select an option

  • Save neuman/7506979e7df94837c9b0 to your computer and use it in GitHub Desktop.

Select an option

Save neuman/7506979e7df94837c9b0 to your computer and use it in GitHub Desktop.
CarteBlanche Codementor Snippets
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