Skip to content

Instantly share code, notes, and snippets.

@dstufft
Created June 5, 2012 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dstufft/2875669 to your computer and use it in GitHub Desktop.
Save dstufft/2875669 to your computer and use it in GitHub Desktop.
# FBV
def dosomething(request):
# 6 lines of setup
if request.METHOD == "POST":
# 12 lines of Post Specific
pass
else:
# 12 lines of get specific
pass
# 12 lines of either method
pass
# CBV
class MyView(View):
def post(request):
self.setup()
# 12 lines of Post specific
self.generic()
def get(request):
self.setup()
# 12 lines of get specific
self.generic()
def setup():
# 6 lines of setup
pass
def genericcrap():
# 12 lines of generic
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment