The following view works as expected
class BrandEditView(PermissionRequiredMixin ,generic.UpdateView):
permission_required = 'change_brand'
template_name = 'brand_update_form.pug'
model = Brand
fields = ['name']
def get_object(self, queryset=None):
print(self.request.user)
self.object = Brand.objects.get(id=self.kwargs['pk'])
obj = Brand.objects.get(id=self.kwargs['pk'])
return obj
After form submission, how do I return to the same view (with the same object), but with context, like a message: "brand edited successfully"/"you can't do that"? I've found a way to redirect to the same view, but not with context.