How to get a list of all Pages by language #289
Answered
by
kaedroho
carlosnasillo
asked this question in
Q&A
-
In the The issue I'm having is that this returns duplicates (English, Spanish) instances for all the posts. Is there a way to filter by a specific language? or similar behaviour so it respects the current locale set by the user (ie.
Thanks. This project looks mega promising. |
Beta Was this translation helpful? Give feedback.
Answered by
kaedroho
Dec 22, 2020
Replies: 1 comment 1 reply
-
You can filter pages by their For example: current_locale_posts = BlogPost.objects.filter(locale=Locale.get_active()) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
carlosnasillo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can filter pages by their
locale
field. To get the current actively locale, useLocale.get_active()
For example: