Skip to content
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

Missing models import in generated migration file #136

Open
archie-ai-code-explain-pr-review bot opened this issue Jul 13, 2024 · 0 comments
Open

Comments

@archie-ai-code-explain-pr-review
  • The issue is that the generated migration file is missing an import statement for the models module, which is causing a NameError when trying to use models.Model in the migration.
  • The provided code in models.py defines a custom MyField that inherits from models.TextField, a MyBaseModel that inherits from models.Model, and a MyModel that inherits from both MyMixin and MyBaseModel.
  • When running the makemigrations command, Django generates a migration file 0001_initial.py that includes the MyModel definition, but it fails to include the necessary import statement for the models module.
  • The expected behavior is for Django to generate a valid Python migration file that includes the necessary import statements. The actual behavior is that the generated migration file is missing the import statement, causing the NameError when trying to use models.Model.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants