id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 12709 Refetch method for getting a fresh model instance Jukka Välimaa nobody "It is often useful to get a fresh instance of a model object, with data from db. A typical case is testing some view code using the test client, when the view is supposed to save some model changes into database. For example: {{{ client.post('some_url', {'id': obj.id, 'description': 'new'}) fresh_obj = ObjClass.objects.get(pk=obj.pk) self.assertEqual('new', fresh_obj.description) }}} This ticket proposes adding a method to Model that can be used to fetch a ""fresh"" version of a model object from the database. It is functionally the same as the use of objects.get in the example above, but more convenient and elegant. {{{ fresh_obj = obj.refetch() }}} " closed Database layer (models, ORM) duplicate refetch Jukka Välimaa Unreviewed 0 0 0 0 0 0