AnkitMitraOfficial / StackOverflowClone

StackOverflowClone
MIT License
3 stars 1 forks source link

Several models.py? #6

Open guettli opened 4 years ago

guettli commented 4 years ago

Hi,

why do you use several models.py files?

guettli@yoga15:~/projects/StackOverFlow-Clone$ find -name models.py

./Contact/models.py
./StackoverflowClone/models.py
./blog/models.py
./Authentication/models.py

I would suggest that you use only one models.py file.

BTW, find is a linux command which lists files.

AnkitMitraOfficial commented 4 years ago

I have done this ,because I don't want to mess them all in a single model.py file ,instead making different models.py gives me more clearance!

guettli commented 4 years ago

You can refactor models.py to a python module.

Create models/ and move model.py to models/__init__.py

You can now move parts of your models to own files.

Example:

models/foo.py

and in models/__init__.py

from .foo import Foo