Skip to content

Instantly share code, notes, and snippets.

View JohnStuartRutledge's full-sized avatar

John Rutledge JohnStuartRutledge

View GitHub Profile

Keybase proof

I hereby claim:

  • I am johnstuartrutledge on github.
  • I am johnrutledge (https://keybase.io/johnrutledge) on keybase.
  • I have a public key ASAvvmTBlRjEWjZkDx4eG5EhTG0_dPcZPkLh0NGGUjt9Cgo

To claim this, I am signing this object:

@JohnStuartRutledge
JohnStuartRutledge / python_idioms.md
Last active February 23, 2023 09:56
A gist for tracking examples of idiomatic Python. The goal is to accrue a list of concrete examples to help develop an intuition of what constitutes "Pythonic" code.

Django Idioms

General Tips

  • put methods that apply to a single instance of a Model on the model class itself
  • put methods meant to query against a Models entire table that models corresponding managers.py file.
  • if a models.py file gets too long to manage then create a models directory and place an __init__ file in it.
  • try to avoid using signals, but if you must then put them in a signals.py file