I'm working (slowly) on a small Flask project. One of my models is a class called Post, which is a lightweight namedtuple. Post objects are created by a PostFactory, because creating a Post involves hitting a database. The PostFactory holds the necessary database connection, so the Post objects can be serialized.
What part of the model/view/controller division does a factory object naturally fit in? Is it part of the models, since it's tightly coupled with Post objects? Or is it a controller, since it manipulates models?
Postobjects get passed a connection to the database and then pull the necessary info, but it seemed messy because posts have nothing to do with database connections. I thought that the thing that madePostobjects should be aPostFactory, do you think that could be confusing because it's too limited? Is there a more reasonable name for "the class whose instances are used to createPostobjects"?Postobjects contain data that's been scraped from another site. They get passed an ID to look up, then pull down information about it from an API.