def check_objects_or_redirect(self):
        if self.creating and self.parent is not None:
            is_valid, reason = self.parent.can_be_parent(give_reason=True)
            if not is_valid:
                messages.error(self.request, reason)
                return redirect('dashboard:catalogue-product-list')
Allows checking the objects fetched by get_object and redirect
dataset/ETHPy150Open django-oscar/django-oscar/src/oscar/apps/dashboard/catalogue/views.py/ProductCreateUpdateView.check_objects_or_redirect