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

Indentation problem while making old_models #43

Closed
saintlyzero opened this issue Sep 16, 2020 · 0 comments · Fixed by #44
Closed

Indentation problem while making old_models #43

saintlyzero opened this issue Sep 16, 2020 · 0 comments · Fixed by #44

Comments

@saintlyzero
Copy link
Contributor

Indentation problem while making old_models.py by merging multiple model files

Here's my project structure

.
├── main.py
├── user
│   ├── models.py
│   └── views.py
├── subscription
│   ├── modely.py
│   └── views.py

user.models.py

from tortoise import fields, models

class Foo(models.Model):
    id = fields.IntField(pk=True)
    fname = fields.CharField()
    class PydanticMeta:
        exclude = ("id")

subscription.models.py

from tortoise import fields, models

class Bar(models.Model):
    id = fields.IntField(pk=True)
    name = fields.CharField()

I have specified both user.modely.py and subscription.models.py in TORTOISE_ORM

When I do $ aerich migrate, while merging both model files into old_models.py it creates indentation error as:

from tortoise import fields, models

class Foo(models.Model):
    id = fields.IntField(pk=True)
    fname = fields.CharField()
    class PydanticMeta:
        exclude = ("id")from tortoise import fields, models

class Bar(models.Model):
    id = fields.IntField(pk=True)
    name = fields.CharField()

This is because there is no new line at the end of users.models.py

I totally understand that under PEP8 standards, a file should always end with a new line, but, I think this case should be handled here

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 a pull request may close this issue.

1 participant