Lucas03
Lucas03

Reputation: 2347

how to handle repeated records in django

I'm building poker website and I would like to create "Tournament schedule", something like this. Problem is, some tournaments are repeated every Monday, some always on 1st day of new month, some every two hours from monday to friday. My two questions are:

  1. How do I implement this, if all information is the same, but date changes by two hours for example. Duplication of records sounds like a stupid idea.
  2. I am adding new tournaments in django admin. Since usually many fields stay the same for different tournaments, is there a way I could let user to save current form and load it later? That would make adding new tournaments much easier and quicker. (I need to store many different pre-populated forms and then choose, which one to use.)

Upvotes: 0

Views: 75

Answers (1)

Aaron Lelevier
Aaron Lelevier

Reputation: 20828

  1. If you are having a poker tournament, you would want a historical record of each tournament, so you would need an unique record for each tournament that happens. Otherwise, you would be mixing old tournaments with new, joining and unjoining player records from them all the time, etc...

  2. Yes, you can set default as a kwarg in the Django models.py for each field, or use an init argument for User form data to pre-populate tournament forms for new tournaments based off the prior form they filled out.

Upvotes: 1

Related Questions