#25127: document how to define models in multiple modules
--------------------------------------+------------------------------------
Reporter: keturn | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by keturn):
Great, I think that's everything we need to know to document this.
That last point (about "always import all models into the models package")
sounds like a stylistic one I'm not yet sure I agree with, but given that
the modules do need to get imported in order for the classes to be
registered, having the documentation suggest a canonical place to do that
importing sounds like a good idea.
I guess the thing I want to get clear on is, if `from path.to.app.models
import WhateverModel` doesn't work, is that a choice that you can make
within your own project's organizational style, or is it something that
will actually break interactions with django core or common third-party
apps? I'm noticing there's an AppConfig.models_module. I'm not sure what
users of that actually do with it, but it sounds like a thing that would
break if you didn't follow that import convention.
--
Ticket URL: <https://code.djangoproject.com/ticket/25127#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.513fa22549d194e112f90f02b4ef8cff%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.