0

I am trying to set up a Website for Employee Scheduling with Django. I am new to Web development, therefore I run into some problems, scince I have the feeling the Web handles things differently. I need to pass information to a solver using pyomo.

For this employees should be able to pass information about their availability through a model form. The employee has to be able to submit his input by clicking in the shift button in the day row. When he is logged in.


e.g:

Day1 : [S1] [S2] [S3] [S4] [S5] [S6]

Day2 : [S1] [S2] [S3] [S4] [S5] [S6]

Day3 : [S1] [S2] [S3] [S4] [S5] [S6]

The data in the database should look like this

Employee               Shift      Day    Available

Username                S1         D1        0
Username                S2         D1        1
Username x              Si         Dk        0

For the solver the information has to be in a dict like this:

Available ={(“Username”, “S1”, “D1”): 0, (“Username”, “S2”, “D1”): 1, (“Username x”, “Si ”, “Dk”): 0}


0 means that the employee is not available on that shift on that day and 1 means he is. The x stands for the next user.

In this example the employee clicked on [S2] in the Day 1 row. So the model should automatically paste the day and the employee name. So I would have to be able to link the button to it’s related day and the model has to get the logged in user name.

Right now I get my data from a csv and transform it into a dict using pandas.

Is there any way to save the passed information as a csv or a dict into a database?

Lukas Humpe
  • 421
  • 3
  • 10

1 Answers1

0

you can use Bulk Create and create a function that adds the data after reading it from the .csv file

bhnir1
  • 1
  • 2
  • Thanks for your answer! But the problem is located at the user input. The employee has to be able (e.g by clicking on shift one in the Day one row) to submit that he is available. – Lukas Humpe Mar 13 '18 at 17:28