3👍
✅
As Nickie suggested in the comments: https://docs.djangoproject.com/en/1.11/ref/class-based-views/mixins-editing/#django.views.generic.edit.DeletionMixin.success_url
Solved this with success_url = "/farm/{farm_id}"
👤Jon
28👍
Yes, you can do this with success_url
in this way:
class DeleteAssignment(DeleteView):
. . . . .
. . . . .
. . . . .
def get_success_url(self):
# if you are passing 'pk' from 'urls' to 'DeleteView' for company
# capture that 'pk' as companyid and pass it to 'reverse_lazy()' function
companyid=self.kwargs['pk']
return reverse_lazy('company', kwargs={'pk': companyid})
This should work perfectly.
- How to Hash Django user password in Django Rest Framework?
- Django AttributeError 'tuple' object has no attribute 'regex'
0👍
The following works:
reverse_lazy('name_of_your_view', kwargs={'key': value})
Not documented either in the man page or in docstring, was suggested by AI.
Source:stackexchange.com