When creating Mutation I get: AttributeError: 'Options' object has no attribute 'name'
See original GitHub issueCreated simple Queries with no issues. No trying to create a Mutation and getting this error.
File "C:\Program Files\Python36\lib\site-packages\graphene\types\typemap.py",
line 236, in construct_fields_for_type
field_type = self.get_field_type(map, field.type)
File "C:\Program Files\Python36\lib\site-packages\graphene\types\typemap.py",
line 295, in get_field_type
return map.get(type._meta.name)
AttributeError: 'Options' object has no attribute 'name'
This is the code
class AddProduct(graphene.Mutation):
class Input:
name = String(required=True)
product = Field(Product)
org = Field(Org)
@classmethod
def mutate(cls, input, context, info):
product_name = input.get('product_name')
org = Org.objects.first();
desc = "description whatever...."
product = Product(name = product_name, org = org, description = desc)
return AddProduct(product = product)
class Mutation(ObjectType):
add_product = AddProduct.Field()
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
AttributeError: type object 'User' has no attribute 'name'
This is a cryptic error that happens when Django Model classes are accidentally used in code instead of graphene Type classes.
Read more >AttributeError: 'Options' object has no attribute 'name'
When creating Mutation I get : AttributeError: 'Options' object has no attribute 'name'
Read more >unittest.mock — getting started — Python 3.11.1 documentation
AttributeError : object has no attribute 'old_method'. Using a specification also enables a smarter matching of calls made to the mock, regardless of...
Read more >'int' object has no attribute 'choice' - appsloveworld.com
I am writing a python program and I get this error: Traceback (most recent call last): File "C:\Users\Joe\SkyDrive\Documents\Python Project\Python\Forest ...
Read more >Configuring the Apollo Client cache - Apollo GraphQL Docs
To learn how to interact with cached data, see Reading and writing data to the cache. Initialization. Create an InMemoryCache object and provide...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Without knowing more about your code, I assume you are using Product and Org from your models and not making them into graphql types. If you make product and Org into graphene types this should work.
Having also just stumbled on this just following the mutation example in the docs ( http://docs.graphene-python.org/en/latest/types/mutations/) , it seems that the exception message could be a bit more helpful.