diff --git a/setup.cfg b/setup.cfg index 877a3a9..49d2fcb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = wagtail_fedit -version = 1.3.7 +version = 1.3.8 description = An application made for the Django Web Framework. long_description = file: README.md long_description_content_type = text/markdown diff --git a/wagtail_fedit/templatetags/fedit.py b/wagtail_fedit/templatetags/fedit.py index 9bf9237..bdd4594 100644 --- a/wagtail_fedit/templatetags/fedit.py +++ b/wagtail_fedit/templatetags/fedit.py @@ -361,7 +361,7 @@ def render_editable_field(request, content, field_name, model, context, **kwargs kwargs["wagtail_fedit_field_name"] = field_name kwargs["wagtail_fedit_instance"] = model - + kwargs["inline"] = str(kwargs.get("inline", False)).lower() == "true" return render_to_string( "wagtail_fedit/content/editable_field.html", { @@ -371,7 +371,6 @@ def render_editable_field(request, content, field_name, model, context, **kwargs "content": content, "parent_context": context, "toolbar_items": items, - "inline": str(kwargs.get("inline", False)).lower() == "true", **kwargs, }, request=request, diff --git a/wagtail_fedit/views/editable.py b/wagtail_fedit/views/editable.py index 0bd3b4e..cf6ce0b 100644 --- a/wagtail_fedit/views/editable.py +++ b/wagtail_fedit/views/editable.py @@ -35,10 +35,10 @@ USERBAR_MODEL_VAR, FeditPermissionCheck, with_userbar_model, - user_can_publish, - user_can_unpublish, - user_can_submit_for_moderation, - lock_info, + # user_can_publish, + # user_can_unpublish, + # user_can_submit_for_moderation, + # lock_info, ) from .mixins import ( @@ -61,6 +61,8 @@ def get_publish_action(object): class BaseFeditView(ObjectViewMixin, FeditPermissionCheck, TemplateView): def dispatch(self, request: HttpRequest, object_id: Any, app_label: str, model_name: str) -> HttpResponse: + if self.error_response: + return self.error_response if not self.has_perms(request, self.object): return HttpResponseForbidden("You do not have permission to view this page") diff --git a/wagtail_fedit/views/mixins.py b/wagtail_fedit/views/mixins.py index bb3c359..9668474 100644 --- a/wagtail_fedit/views/mixins.py +++ b/wagtail_fedit/views/mixins.py @@ -25,6 +25,7 @@ def setup(self, request: HttpRequest, object_id: Any, app_label: str, model_name except (self.model.DoesNotExist): self.error_response = HttpResponseBadRequest("Model not found") + def dispatch(self, request: HttpRequest, object_id: Any, app_label: str, model_name: str) -> HttpResponse: if self.error_response: return self.error_response