Guest User

Untitled

a guest
Nov 16th, 2010
194
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. >>> def modify_model_state(model):
  2. ...   model.state = 'Closed'
  3. ...   model.save()
  4. ...
  5. >>> model = get_object_or_404(Model, pk=pk_object)
  6. >>> model.state
  7. u'Open'
  8. >>> modify_model_state(model)
  9. >>> model.state
  10. u'Open'
  11. >>> the_same_model = Model.objects.get(id=pk_object)
  12. >>> the_same_model.state
  13. u'Closed'
  14. >>>
RAW Paste Data