Giter Site home page Giter Site logo

Comments (2)

isaacfink avatar isaacfink commented on May 31, 2024

Is there any update on this?

from graphene-django-cud.

NwawelAIroume avatar NwawelAIroume commented on May 31, 2024

Hi I have these models

class package(models.Model):
    items = models.ManyToManyField('product.item', verbose_name=_("Items"), related_name="package_items")

class item(models.Model):
    products = models.ManyToManyField('product.product', verbose_name=_("Products"), null=True, blank=True)

class product(models.Model):
    options = models.ManyToManyField("product.option", verbose_name=_("Product options"), null=True, blank=True)

and this is my mutation for package and item

class create_package(DjangoCreateMutation):
    class Meta:
        model = package
        many_to_many_extras = {
            'items': {
                'add':{'type': 'CreateitemInput'}
            }
        }

class create_item(DjangoCreateMutation):
    class Meta:
        model = item
        many_to_many_extras = {
            'products': {
                'add':{'type': 'CreateproductInput'}
            }
        }

class create_product(DjangoCreateMutation):
    class Meta:
        model = product
        many_to_many_extras = {
            'options': {
                'add':{'type': 'CreateoptionInput'}
            }
        }

And when I run a mutation like this:

mutation{
  createPackage(
    input:{
      name:"random"
      description:"boring"
      sideBarText:"sample"
      items:[
        1
      ]
      itemsAdd:[
        {
          name:"bla bla bla"
          displayName:"kdjhb"
          products:[
            "cHJvZHVjdF90eXBlOjE="
          ]
          productsAdd:[
            {
              name:"product bla"
              description:"double trouble"
              price:"99.99"
            }
          ]
        }
      ]
    }
  ){
    package{
      name
      items{
        edges{
          node{
            name
            products{
              edges{
                node{
                  name
                  price
                }
              }
            }
          }
        }
      }
    }
  }
}

I only get the added product returned, why isn't the other product being added?

many-to-many is working on my side
Please can you highlight or point out which item is added and which ones are not added?

from graphene-django-cud.

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.