title: Get saved object of a model form in Django?
body: <p>I just want to access model details just after posting it with model form in Django. This <a href="https://stackoverflow.com/questions/7428245/model-form-save-get-the-saved-object">guy</a> also had asked the same thing but when i try the 
  accepted answer, it returns none type value.</p>
  
  <p>Here is my code in 'views.py':</p>
  
  <pre><code>if request.method == 'POST':
      if request.user.is_authenticated():
          form = PostStoryForm(request.POST)
          if form.is_valid():
              obj = form.save(commit=False)
              obj.author = request.user
              new_post = obj.save()
              print(new_post)
  </code></pre>
  
  <p>The Code above saves the form to the database successfully but 'new_post' variable is 'None'. For example when i tried to access 'new_post.title' which is a field in my model, it returns 'AttributeError' which says 'NoneType' object has no attribute 'title'</p>
  
  <p>what am i doing wrong?</p>