1👍
✅
You can override the .get_success_url(…)
method to return the URL to redirect to by the browser:
class SchedaCreateView(CreateView):
model = Schede
fields = ['nome_scheda','data_inizio','data_fine']
template_name = 'crea/passo1.html'
def form_valid(self, form):
form.instance.utente = self.request.user
return super().form_valid(form)
def get_success_url(self):
return reverse('creazione_passo1', kwargs={ 'nome': self.object.nome })
Source:stackexchange.com