Skip to content

Commit

Permalink
Using a context processor instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash-Crow committed Jan 22, 2024
1 parent 07b2f54 commit 1d97baf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"django.contrib.messages.context_processors.messages",
"wagtail.contrib.settings.context_processors.settings",
"wagtailmenus.context_processors.wagtailmenus",
"content_manager.context_processors.skiplinks",
],
},
},
Expand Down
7 changes: 7 additions & 0 deletions content_manager/context_processors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def skiplinks(request):
return {
"skiplinks": [
{"link": "#content", "label": "Contenu"},
{"link": "#fr-navigation", "label": "Menu"},
]
}
9 changes: 0 additions & 9 deletions content_manager/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@ class ContentPage(Page):
index.SearchField("body"),
]

def get_context(self, request, *args, **kwargs):
context = super().get_context(request, *args, **kwargs)

context["skiplinks"] = [
{"link": "#content", "label": "Contenu"},
{"link": "#fr-navigation", "label": "Menu"},
]
return context


class MonospaceField(models.TextField):
"""
Expand Down

0 comments on commit 1d97baf

Please sign in to comment.