Skip to content

Commit

Permalink
Merge pull request #824 from Inter-Actief/822-add-the-about-module-to…
Browse files Browse the repository at this point in the history
…-the-graphql-api

Add about pages to the GraphQL API
  • Loading branch information
Mihai98924 authored Feb 5, 2024
2 parents bbe0053 + edd5448 commit 402b5ec
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 1 deletion.
43 changes: 43 additions & 0 deletions amelie/about/graphql.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from django.db.models import Q
from django.utils.translation import gettext_lazy as _
import graphene
from graphene_django import DjangoObjectType

from amelie.about.models import Page
from amelie.graphql.pagination.connection_field import DjangoPaginationConnectionField


class PageType(DjangoObjectType):
class Meta:
model = Page
description = "Type definition for a single Page"
fields = ["name_nl", "name_en", "slug_nl", "slug_en", "educational", "content_nl", "content_en", "last_modified"]

name = graphene.String(description=_("Page name"))
slug = graphene.String(description=_("Page slug"))
content = graphene.String(description=_("Page content"))

def resolve_name(obj: Page, info):
return obj.name

def resolve_slug(obj: Page, info):
return obj.slug

def resolve_content(obj: Page, info):
return obj.content


class AboutQuery(graphene.ObjectType):
page = graphene.Field(PageType, id=graphene.ID(), slug=graphene.String())

def resolve_page(self, info, id=None, slug=None):
if id is not None:
return Page.objects.get(pk=id)
if slug is not None:
return Page.objects.get(Q(slug_en=slug) | Q(slug_nl=slug))
return None


# Exports
GRAPHQL_QUERIES = [AboutQuery]
GRAPHQL_MUTATIONS = []
1 change: 1 addition & 0 deletions amelie/settings/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@
}

GRAPHQL_SCHEMAS = [
"amelie.about.graphql",
"amelie.activities.graphql",
"amelie.companies.graphql",
"amelie.education.graphql",
Expand Down
Binary file modified locale/nl/LC_MESSAGES/django.mo
Binary file not shown.
17 changes: 16 additions & 1 deletion locale/nl/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-11 22:08+0100\n"
"PO-Revision-Date: 2023-12-11 22:09+0018\n"
"PO-Revision-Date: 2024-02-05 20:44+0018\n"
"Last-Translator: <>\n"
"Language: en\n"
"MIME-Version: 1.0\n"
Expand All @@ -12,6 +12,21 @@ msgstr ""
"Used command: ./manage.py makemessages -e py,html,txt,mail\n"
"X-Translated-Using: django-rosetta 0.9.9\n"

#: amelie/about/graphql.py:16
#| msgid "Person name"
msgid "Page name"
msgstr "Naam van de pagina"

#: amelie/about/graphql.py:17
#| msgid "Pages"
msgid "Page slug"
msgstr "Pagina slug"

#: amelie/about/graphql.py:18
#| msgid "Save comment"
msgid "Page content"
msgstr "Pagina inhoud"

#: amelie/about/models.py:9 amelie/activities/models.py:26 amelie/activities/models.py:464 amelie/activities/templates/activity_enrollment_overview.html:62 amelie/activities/templates/activity_enrollment_overview.html:180 amelie/activities/templates/activity_enrollment_print.html:29 amelie/claudia/templates/claudia/aliasgroup_list.html:21 amelie/claudia/templates/claudia/contact_list.html:20 amelie/claudia/templates/claudia/email_detail.html:16 amelie/claudia/templates/claudia/extragroup_list.html:21 amelie/claudia/templates/claudia/extraperson_list.html:20 amelie/claudia/templates/claudia/mapping_detail.html:18 amelie/claudia/templates/claudia/mapping_detail.html:84 amelie/claudia/templates/claudia/mapping_detail.html:139 amelie/claudia/templates/claudia/mapping_timeline.html:21 amelie/claudia/templates/claudia/shareddrive_list.html:21 amelie/claudia/templates/claudia/timeline_list.html:20 amelie/education/models.py:25 amelie/education/models.py:47 amelie/education/models.py:132 amelie/education/models.py:178 amelie/members/models.py:36 amelie/members/models.py:57 amelie/members/models.py:81 amelie/members/models.py:121 amelie/members/models.py:218 amelie/members/models.py:248 amelie/members/models.py:660 amelie/members/models.py:690 amelie/members/models.py:874 amelie/members/models.py:897 amelie/members/templates/committee_members.html:7 amelie/members/templates/includes/registration/personal_details.html:14 amelie/members/templates/includes/registration/personal_details_employee.html:14 amelie/members/templates/registration_check.html:34 amelie/personal_tab/models.py:253 amelie/personal_tab/models.py:281 amelie/personal_tab/models.py:319 amelie/personal_tab/statistics.py:266 amelie/personal_tab/templates/exports/screen.html:67 amelie/room_duty/models.py:17 amelie/tools/pdf.py:98
msgid "Name"
msgstr "Naam"
Expand Down

0 comments on commit 402b5ec

Please sign in to comment.