Created
April 19, 2013 07:51
-
-
Save konradhalas/5418801 to your computer and use it in GitHub Desktop.
Model instance refresh (reload from DB) function, especially useful in tests.
This file contains 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
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