Saturday, January 30, 2021

how to split in multiple file class models.py?

Hello everyone, I have a question about Django and the use of namespaces or packages to split the models.py file.
I would like to adopt the Java philosophy in which one file corresponds one class and one db table.
I tried to follow this guide, but it doesn't work.
https://docs.djangoproject.com/en/3.1/ref/applications/#namespace-packages-as-apps

when I execute this command: "python manage.py makemigrations myapp"

Return this warning: "No changes detected in app"

Is it possible to do this structure?

/models
    __init__py # if i use package, or without for namespace
         #common import
    car.py # class car
    group.py # class group
    manufactor.py # class manufactor
    /otherPackage
        __init__py
            common import
        otherClass.py

I hope you understand what I'd like to do.
Thank you.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6cdc67de-94cb-4ad3-8c73-bc91da02b8bfn%40googlegroups.com.

No comments:

Post a Comment