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.

Different types with the same name in the schema - Django fields with choices

See original GitHub issue

Hi,

When you try to create a model with choices field and then create a second model which inherit from the previous one, you will receive error while schema generating.

Here you have a simple project with models and basic configuration. Try to generate schema and you will get following error:

AssertionError: Found different types with the same name in the schema: PageType, PageType.

It seems that it is unable to inherit models with choices fields.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:21
  • Comments:47 (13 by maintainers)

github_iconTop GitHub Comments

40reactions
Tyrdallcommented, Jul 10, 2017

It seems you’re not allowed to include type in your field’s name. I tried type = models.CharField() and foo_type = models.CharField() and both caused that error.

When I changed the field’s name to foo the error was gone.

11reactions
darkowiccommented, Jan 28, 2018

Is it documented anywhere that we can not use field name type in models when using this library?

Read more comments on GitHub >

github_iconTop Results From Across the Web

AssertionError: Found different types with the same name in ...
I was having the same issue. In my particular case the issue is a conflict internal workings of SQLAlchemy when a backref is...
Read more >
Model field reference - Django documentation
Though you can define a choices list outside of a model class and then refer to it, defining the choices and names for...
Read more >
Django models: Declaring a list of available choices in the ...
Choosing the right way to declare a list of available choices passed to Django model fields may be a problem. How to solve...
Read more >
Python Examples of graphene.Field - ProgramCreek.com
You may also want to check out all available functions/classes of the module ... AssertionError: Found different types # with the same name...
Read more >
Django model data types
For example, Django model field parameters like choices enforce a field's values conform to a set of choices, this type of rule is...
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