Skip to content

Commit

Permalink
Fix Wagtail page previews (#489)
Browse files Browse the repository at this point in the history
  • Loading branch information
CamLamb authored Oct 30, 2023
1 parent b44b7dc commit 983203b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
19 changes: 13 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ django-crispy-forms = "^1.14.0"
django-environ = "^0.10.0"
# django_redis = "^5.2.0"
django-settings-export = "^1.2.1"
django-simple-history = "^3.3.0"
# TODO: Set django-simple-history to the next release after 3.4.0 (when released)
django-simple-history = { git = "https://github.com/uktrade/django-simple-history.git", rev = "29108a5" }
django-storages = "^1.13.2"
django-webpack-loader = "^1.8.1"
djangorestframework = "^3.14.0"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ django-log-formatter-ecs==0.0.5 ; python_version >= "3.11" and python_version <
django-modelcluster==6.1 ; python_version >= "3.11" and python_version < "4.0"
django-permissionedforms==0.1 ; python_version >= "3.11" and python_version < "4.0"
django-settings-export==1.2.1 ; python_version >= "3.11" and python_version < "4.0"
django-simple-history==3.4.0 ; python_version >= "3.11" and python_version < "4.0"
django-simple-history @ git+https://github.com/uktrade/django-simple-history.git@29108a5 ; python_version >= "3.11" and python_version < "4.0"
django-staff-sso-client==4.2.1 ; python_version >= "3.11" and python_version < "4.0"
django-storages==1.14.2 ; python_version >= "3.11" and python_version < "4.0"
django-taggit==3.1.0 ; python_version >= "3.11" and python_version < "4.0"
Expand Down
8 changes: 4 additions & 4 deletions src/working_at_dit/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,28 @@ def get_context(self, request, *args, **kwargs):
context = super().get_context(request, *args, **kwargs)

context["related_news"] = PageTopic.objects.filter(
topic=self.contentpage, page__content_type__app_label="news"
topic=self, page__content_type__app_label="news"
).order_by("-page__last_published_at")[:5]

context["policies_and_guidance"] = (
ContentPage.objects.public()
.live()
.filter(
topics__topic=self.contentpage,
topics__topic=self,
content_type__app_label="working_at_dit",
)
.filter(Q(content_type__model="policy") | Q(content_type__model="guidance"))
.order_by("-last_published_at")
)

tools = PageTopic.objects.filter(
topic=self.contentpage, page__content_type__app_label="tools"
topic=self, page__content_type__app_label="tools"
).order_by("page__last_published_at")

context["tools"] = tools

how_do_is = PageTopic.objects.filter(
topic=self.contentpage,
topic=self,
page__content_type__app_label="working_at_dit",
page__content_type__model="howdoi",
page__live=True,
Expand Down

0 comments on commit 983203b

Please sign in to comment.