def create(request, document_id): document = get_object_or_404(edit.models.Document, id=document_id) token_form = TokenForm(request.POST) if token_form.is_valid(): token = token_form.save(commit=False) token.document_id = document.id token.save() return redirect(reverse('edit:index', kwargs={'document_id': document_id}) + "#fndtn-tokens")