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

Add a basic Django model generator. #556

Merged
merged 1 commit into from
Dec 16, 2024
Merged

Add a basic Django model generator. #556

merged 1 commit into from
Dec 16, 2024

Conversation

vpetrovykh
Copy link
Member

Due to limitations of Django the schema must only have the default module. Also all link properties and multi properties are forbidden since they produce models without a unique id (or other primary key) column. Django cannot properly handle updates to that.

Added tests for the generated Django models.

@vpetrovykh vpetrovykh requested a review from msullivan December 9, 2024 08:39
@vpetrovykh vpetrovykh force-pushed the gel-django branch 2 times, most recently from 3d6d5bf to ba850f1 Compare December 13, 2024 21:30
Copy link
Member

@msullivan msullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you post the generated output for the test in a gist or something, so we can look at it easily?

self._indent_level -= 1

def reset_indent(self):
self._indent_level -= 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing you want = here instead

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I fixed it to = :)

Due to limitations of Django the schema must only have the `default`
module. Also all link properties and multi properties are forbidden
since they produce models without a unique `id` (or other primary key)
column. Django cannot properly handle updates to that.

Added tests for the generated Django models.
@vpetrovykh
Copy link
Member Author

Here are the models generated from the schema I used for Django tests:
https://gist.github.com/vpetrovykh/ef93630efdb3ca13cda2b144c8825c7f

@vpetrovykh vpetrovykh merged commit ad37a6b into master Dec 16, 2024
62 checks passed
@vpetrovykh vpetrovykh deleted the gel-django branch December 16, 2024 23:56
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

Successfully merging this pull request may close these issues.

2 participants