I use generic views/class-based views in my project and I want to call some functions if view is done successfully. I use for this def get_success_url() method. But I can't reach the model in that function. How can I get rid of this, or are there any other way to do this?
My codes:
class MyModelUpdate(UpdateView):
model = MyModel
fields = ['details']
def get_success_url(self, **kwargs):
add_log(form.model, 2, 1, request.POST.user)
return reverse_lazy('model-detail', kwargs = {'pk' : self.kwargs['model_id'] })