Hi André,
On 02/04/2016 02:47 PM, André Meyer-Vitali wrote:
> How would I modify my contest app so that it knows about multiple
> contests? Database models (and queries), templates, forms, urls need to
> be adapted, I guess. Is it sufficient to add an ID to the models such
> that a specific month's data can be selected, for example?
>
> Is there an example to check out somewhere?
These are hard questions to answer without knowing more about your
contest app: how it works currently, what it does, what models it has,
and how you want it to work with a new contest each month.
I would imagine something like having a Contest model (maybe with a
start_date field and an end_date field?), so you can create a new
Contest anytime you want, and then having any other models in the app
all link (with a ForeignKey) to the Contest model, so all their
instances are specific to one Contest. That would be the more flexible
approach.
But I suppose if you are sure that you want "one contest each month" and
that's it, no more flexibility is needed, you could just add date fields
to some of the other models and then modify your queries to select only
objects for the current month?
Carl