Skip to content

Commit

Permalink
Exclude FAQs from the FAQ project list
Browse files Browse the repository at this point in the history
  • Loading branch information
joahim committed Nov 24, 2021
1 parent 87b9eb3 commit 5e3527f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sledilnik/faq/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ class Meta:
fields = ["position", "question", "answer"]
cache = SimpleCache(timeout=60, public=True)

def dehydrate(self, bundle):
del(bundle.data["resource_uri"])

return bundle


class FaqProjectResource(ModelResource):
faq = fields.ToManyField(FaqResource, "faqs", full=True)
faq = fields.ToManyField(FaqResource, "faqs", full=True, use_in="detail")

class Meta:
resource_name = "faq"
Expand All @@ -27,7 +32,6 @@ class Meta:

def dehydrate(self, bundle):
lang = bundle.request.GET.get("lang")

if lang not in [lng[0] for lng in settings.LANGUAGES]:
lang = settings.LANGUAGE_CODE
translation.activate(lang)
Expand Down

0 comments on commit 5e3527f

Please sign in to comment.