67
maybe you could use get_success_url()
method (see reference)
In this case, it’d be something like:
def get_success_url(self):
return reverse('offerta_create',args=(self.object.id,))
0
Please see the accepted answer on Why doesn't self.object in a CreateView have an id after saving to the database? – once I removed the “id” fields from my models, and let Django default to its own id AutoField on each model as recommended in that answer, self.object.id worked fine in my CreateView.
- [Django]-Redirect to Next after login in Django
- [Django]-Django is_staff permission decorator
- [Django]-Visual Editor for Django Templates?
Source:stackexchange.com