Skip to content

Commit

Permalink
fix: Fix fields and filter fields mixup
Browse files Browse the repository at this point in the history
Django Graphene / Django Filters have a slightly different interface
for declaring filter fields on DjangoObjectType and FilterSet.
  • Loading branch information
David Code Howard committed Sep 29, 2023
1 parent 90657e5 commit bbcbc4c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion terraso_backend/apps/graphql/schema/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Query {
): GroupAssociationNode!
groups(offset: Int, before: String, after: String, first: Int, last: Int, name: String, name_Icontains: String, name_Istartswith: String, slug: String, slug_Icontains: String, description_Icontains: String, memberships_Email: String, associatedLandscapes_IsDefaultLandscapeGroup: Boolean, associatedLandscapes_Isnull: Boolean, associatedLandscapes_IsPartnership: Boolean): GroupNodeConnection
landscapes(offset: Int, before: String, after: String, first: Int, last: Int, name_Icontains: String, description_Icontains: String, slug: String, slug_Icontains: String, website_Icontains: String, location_Icontains: String): LandscapeNodeConnection
users(offset: Int, before: String, after: String, first: Int, last: Int, email: String, firstName: String, lastName: String, profileImage: String, memberships: ID, preferences: ID, user_InProject: String): UserNodeConnection
users(offset: Int, before: String, after: String, first: Int, last: Int, email: String, email_Icontains: String, firstName_Icontains: String, lastName_Icontains: String, user_InProject: String): UserNodeConnection
landscapeGroups(offset: Int, before: String, after: String, first: Int, last: Int, landscape: ID, landscape_Slug_Icontains: String, group: ID, group_Slug_Icontains: String, isDefaultLandscapeGroup: Boolean, isPartnership: Boolean): LandscapeGroupNodeConnection
memberships(offset: Int, before: String, after: String, first: Int, last: Int, group: ID, group_In: [ID], group_Slug_Icontains: String, group_Slug_In: [String], user: ID, user_In: [ID], userRole: CoreMembershipUserRoleChoices, user_Email_Icontains: String, user_Email_In: [String], membershipStatus: CoreMembershipMembershipStatusChoices): MembershipNodeConnection
groupAssociations(offset: Int, before: String, after: String, first: Int, last: Int, parentGroup: ID, childGroup: ID, parentGroup_Slug_Icontains: String, childGroup_Slug_Icontains: String): GroupAssociationNodeConnection
Expand Down
3 changes: 1 addition & 2 deletions terraso_backend/apps/graphql/schema/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@ class UserFilter(FilterSet):

class Meta:
model = User
filter_fields = {
fields = {
"email": ["exact", "icontains"],
"first_name": ["icontains"],
"last_name": ["icontains"],
}
fields = ("email", "first_name", "last_name", "profile_image", "memberships", "preferences")

def filter_user_in_project(self, queryset, name, value):
return queryset.filter(collaboration_memberships__membership_list__project__id=value)
Expand Down

0 comments on commit bbcbc4c

Please sign in to comment.