question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

InputObjectType fields from models

See original GitHub issue

I’ve used a MongoengineObjectType class to define the schema from model. There’s a way to use a reference model to define a InputObjectType or AbstractType class? Something like that:

class UserFields(graphene.AbstractType):
	class Meta:
		model = model.User

class User(graphene.ObjectType, UserFields):
	pass

class UserInput(graphene.InputObjectType, UserFields):
	pass


Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
nephew92commented, Feb 27, 2020

@nephew92 : could you share your implementation? I can learn from it and try if I can hook (and refactor) it into graphene-mongo, thanks.

I can’t help with this, sorry. I’d implemented that for a company that I don’t have collaboration anymore, also I don’t have repo backups neither I remember the code details to how I resolved this problem.

2reactions
BenoitTouletcommented, Nov 4, 2020

Hello, I just published on a fork, a simple implementation allowing interface and input graphene objects creation based on graphene_mongo… https://github.com/BenoitToulet/graphene-mongo/tree/feat-support-inputs-and-interfaces Maybe a candidate for future PR…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a way to elegantly use a django model as an input ...
Field() schema = Schema(mutation=PersonMutations) ... (InputObjectType derived class) which can retrieve fields from django form):
Read more >
How to use the graphene.InputObjectType function in ... - Snyk
InputObjectType examples, based on popular ways it is used in public projects. ... class Meta: model = StructureModel class InputNode(graphene.
Read more >
inputObjectType - GraphQL Nexus
inputObjectType. GraphQL Docs for Input Object Types. Defines a complex object which can be passed as an input value. 1import { extendType, inputObjectType...
Read more >
Python Examples of graphene.InputObjectType
This page shows Python examples of graphene.InputObjectType.
Read more >
How to map graphene.InputObjectType fields to kwargs?-django
InputObjectType fields to kwargs?-django ... Django Rest Framework v3.0 : How to map custom serializer fields to model field while saving an object?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found