title: Django: access form argument in CreateView to pass to get_success_url
body: <p><strong>I use CreateView to let a user create a Piece. The Piece will automatically be assigned an id.</strong> After the user created the Piece I would like to redirect using get_success_url to another CreateView to add Versions of the Piece.
  First of all, I do not know where the id of the Piece comes from (since it is generated automatically; I imagine this is the row number of the Piece in the model). <strong>How can I access this id to pass it to get_success_url?</strong>
  The get_context_data method in CreateView seems not to be able to get the Piece id.</p>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>class PieceCreate(LoginRequiredMixin, CreateView):
      model = Piece
      fields = ['title', 'summary', 'created', 'piece_type']
      initial = {'created': datetime.date.today()}
  
      def form_valid(self, form):
          form.instance.creator = Creator.objects.get(user=self.request.user)
          return super(PieceCreate, self).form_valid(form)
  
      def get_context_data(self, **kwargs):
          context = super(PieceCreate, self).get_context_data(**kwargs)
          return context['id']
  
      def get_success_url(self):
          return reverse_lazy('pieceinstance-create', kwargs={'pk': self.get_context_data()})
  </code></pre>
  
  <p><strong>urls.py</strong></p>
  
  <pre><code>path('pieceinstance/create/&lt;int:pk&gt;', views.PieceInstanceCreate.as_view(), name='pieceinstance-create')
  </code></pre>