0

I want to create a table in database which will store the holidays of three months that are August, September and October. I am planning to create this array because different months will have different list of holidays which we cant store in postgres database. This table "Holidays" will have only one row with array in each column for August, September and October. Later when I have to check a date from psql query, I can check the arrays in this table for a particular month to find whether it is a holiday or not. So I have two questions. First how can we define this model in Django models.py file. Actually I am creating a populating script which fills the data in the tables created by Django models. And second, is there a better way of doing this ?

2
  • 1
    Why arrays? Why not a row per holiday, with separate columns for day and month - or even a single date column? Commented Nov 8, 2018 at 12:42
  • Thanks. That would be better. Commented Nov 8, 2018 at 12:57

1 Answer 1

1

Django 2.1 documentation have details how to use array field.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.