Skip to content

Get all model bases from runtime context #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 28, 2019

Conversation

mkurnikov
Copy link
Member

@mkurnikov mkurnikov commented Sep 23, 2019

Fixes #68
@pirate Try this and let me know if it helps.

TODO:

  • Look for model bases in the get_base_class_hook using this method
  • Tests

@mkurnikov
Copy link
Member Author

@pirate Does the emoji mean that this PR worked for you?

@mkurnikov mkurnikov added this to the 1.2.0 milestone Sep 24, 2019
@pirate
Copy link
Contributor

pirate commented Sep 24, 2019

Emoji was from reading the code earlier and seeing that it looked correct superficially, but I just tested it now and it worked! Thanks so much!

@mkurnikov
Copy link
Member Author

@msullivan Back then, you've asked about which benefits django-stubs gets from depending on Django runtime.
This particular issue #68 could be solved with three different solutions:

  1. Add type annotations to all third-party libs with custom base models.
  2. This hack Requiring field annotations even though type can be inferred from field type #68 (comment)
  3. And solution presented in this PR, which just reads all model base classes from runtime.

@mkurnikov mkurnikov merged commit 2c23d8e into typeddjango:master Sep 28, 2019
@mkurnikov mkurnikov deleted the custom-model-base branch September 28, 2019 01:05
voidus pushed a commit to voidus/django-stubs that referenced this pull request Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Requiring field annotations even though type can be inferred from field type
2 participants