Skip to content

Instantly share code, notes, and snippets.

@konradhalas
Created April 19, 2013 07:51
Show Gist options
  • Save konradhalas/5418801 to your computer and use it in GitHub Desktop.
Save konradhalas/5418801 to your computer and use it in GitHub Desktop.
Model instance refresh (reload from DB) function, especially useful in tests.
def refresh(instance):
return instance.__class__._default_manager.get(pk=instance.pk)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment