Git Product home page Git Product logo

Comments (4)

docelic avatar docelic commented on May 29, 2024 3

Nice effort @art1415926535 , thank you in the name of all interested in this module!

from graphene-sqlalchemy-filter.

art1415926535 avatar art1415926535 commented on May 29, 2024 1

Hi @bhavnish07! I have reproduced your example here https://github.com/art1415926535/graphene-sqlalchemy-filter/tree/issue_35/examples/groups_and_tasks.

Everything seems to work fine.

image
image

from graphene-sqlalchemy-filter.

Baddhizm avatar Baddhizm commented on May 29, 2024

Try this code:

class GroupFilter(FilterSet):
    class Meta:
        model = GroupModel
        fields = {
            # some fields
        }


class TaskFilter(FilterSet):
    class Meta:
        model = TaskModel
        fields = {
            # some fields
        }


class CustomFilterableConnectionField(FilterableConnectionField):
    filters = {
        TaskModel: TaskFilter(), 
        GroupModel: GroupFilter()
    }


class TaskNode(SQLAlchemyObjectType):
    class Meta:
        model = TaskModel
        interfaces = (Node,)
        connection_field_factory = CustomFilterableConnectionField.factory


class GroupNode(SQLAlchemyObjectType):
    class Meta:
        model = GroupModel
        interfaces = (Node,)
        connection_field_factory = CustomFilterableConnectionField.factory


class TaskConnection(Connection):
    class Meta:
        node = TaskNode


class GroupConnection:
    class Meta:
        node = GroupNode


class Query(ObjectType):
    all_tasks = CustomFilterableConnectionField(TaskConnection)
    all_groups = CustomFilterableConnectionField(GroupConnection)

from graphene-sqlalchemy-filter.

bhavnish07 avatar bhavnish07 commented on May 29, 2024

Hi!
We actually want to do query on groups and filter tasks fields from it (groups and tasks are related in one to many relationship) . Others queries were just for testing the filter.

  • Filters are working for groups and tasks independently but when we try to have a filter on groups and try to filter tasks field from it. It seems to not work.

Filters are not working for the below query:

query($id: ID!) {
  filterGroup (id: $id) {
    tasks  (filters:
       { categories:"Health"}
    )
      {
      edges {
        node {
          id
          group {
            id
          }
          title
          done
          categories
        }
      }
    }
  }
}

It seems like nested filters are not working.

from graphene-sqlalchemy-filter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.