Creating reusable Django models
Having some trouble designing an application using Django models. More
specifically, I am trying to decide in which application a given model
should go.
A good example would be with a model where different analyses would be
performed on an object. For example, if I were doing an analysis on the
efficiency of a prostitution ring, I would have three models: Pimp, Whore,
and Client:
The pimp object would have a "stable" attribute which represents the
one-to-many relationship between the Pimp and his whores.
The Whore object would have a many-to-many relationship with the Client
object, or, there would be an additional "Trick" object, representing the
relationship between Whores and Clients.
If I wanted to analyze these objects in one way, i.e. seeing each whore's
percent time "occupied", this would be one simple application. But what if
I wanted to do additional analysis on these objects, i.e. see what whores
are the most "in demand"? It would make sense to me that each kind if
analysis belongs to an individual app, but then to which app do these
common objects belong?
Is there a common place where these common models should be stored? Should
all analyses be contained in one app?
No comments:
Post a Comment