① Schichttabelle: Nur der Administrator kann die Uhrzeit bearbeiten. (2) Schichttabelle: Ich möchte, dass Sie die Schichterstellung nach Tag kopieren ③ Gewünschte Schicht: Bis zum 5. eines jeden Monats bitten wir um eine Schichtanforderung und erstellen und verteilen sie bis zum 10., also geben Sie Einschränkungen ein, mit denen Sie bis 5 eingeben können ④ Bulletin Board: Benachrichtigen Sie jede Einrichtung ⑤ Aufgabe Es ist am besten, wenn Sie übernehmen können, was Sie tun müssen
Da ① abgeschlossen ist, haben wir ② begonnen.
Ich habe eine neue BaseShift-Tabelle mit Benutzerinformationen erstellt und dort die grundlegende Verschiebung registriert.
schedule/models.py
class BaseShift(models.Model):
id = models.AutoField(verbose_name='Gewünschte Schicht-ID',primary_key=True)
user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name='Mitarbeitername')
getsu_shift_name_1 = models.ForeignKey(Shift, verbose_name='Mond_1 Schichtname', related_name='base_shift_getsu_shift_name_1',on_delete=models.SET_NULL,null= True)
getsu_shisetsu_name_1 = models.ForeignKey(Shisetsu, verbose_name='Mond_1 Einrichtung', related_name='base_shift_getsu_shisetsu_name_1',on_delete=models.SET_NULL,blank=True, null=True)
getsu_shift_name_2 = models.ForeignKey(Shift, verbose_name='Mond_2 Schichtname', related_name='base_shift_getsu_shift_name_2',on_delete=models.SET_NULL,blank=True, null=True)
getsu_shisetsu_name_2 = models.ForeignKey(Shisetsu, verbose_name='Mond_2 Einrichtungen', related_name='base_shift_getsu_shisetsu_name_2',on_delete=models.SET_NULL,blank=True, null=True)
getsu_shift_name_3 = models.ForeignKey(Shift, verbose_name='Mond_3 Schichtname', related_name='base_shift_getsu_shift_name_3',on_delete=models.SET_NULL,blank=True, null=True)
getsu_shisetsu_name_3 = models.ForeignKey(Shisetsu, verbose_name='Mond_3 Einrichtungen', related_name='base_shift_getsu_shisetsu_name_3',on_delete=models.SET_NULL,blank=True, null=True)
getsu_shift_name_4 = models.ForeignKey(Shift, verbose_name='Mond_4 Schichtname', related_name='base_shift_getsu_shift_name_4',on_delete=models.SET_NULL,blank=True, null=True)
getsu_shisetsu_name_4 = models.ForeignKey(Shisetsu, verbose_name='Mond_4 Einrichtungen', related_name='base_shift_getsu_shisetsu_name_4',on_delete=models.SET_NULL,blank=True, null=True)
ka_shift_name_1 = models.ForeignKey(Shift, verbose_name='Feuer_1 Schichtname', related_name='base_shift_ka_shift_name_1',on_delete=models.SET_NULL,blank=True, null=True)
ka_shisetsu_name_1 = models.ForeignKey(Shisetsu, verbose_name='Feuer_1 Einrichtung', related_name='base_shift_ka_shisetsu_name_1',on_delete=models.SET_NULL,blank=True, null=True)
ka_shift_name_2 = models.ForeignKey(Shift, verbose_name='Feuer_2 Schichtname', related_name='base_shift_ka_shift_name_2',on_delete=models.SET_NULL,blank=True, null=True)
ka_shisetsu_name_2 = models.ForeignKey(Shisetsu, verbose_name='Feuer_2 Einrichtungen', related_name='base_shift_ka_shisetsu_name_2',on_delete=models.SET_NULL,blank=True, null=True)
ka_shift_name_3 = models.ForeignKey(Shift, verbose_name='Feuer_3 Schichtname', related_name='base_shift_ka_shift_name_3',on_delete=models.SET_NULL,blank=True, null=True)
ka_shisetsu_name_3 = models.ForeignKey(Shisetsu, verbose_name='Feuer_3 Einrichtungen', related_name='base_shift_ka_shisetsu_name_3',on_delete=models.SET_NULL,blank=True, null=True)
ka_shift_name_4 = models.ForeignKey(Shift, verbose_name='Feuer_4 Schichtname', related_name='base_shift_ka_shift_name_4',on_delete=models.SET_NULL,blank=True, null=True)
ka_shisetsu_name_4 = models.ForeignKey(Shisetsu, verbose_name='Feuer_4 Einrichtungen', related_name='base_shift_ka_shisetsu_name_4',on_delete=models.SET_NULL,blank=True, null=True)
sui_shift_name_1 = models.ForeignKey(Shift, verbose_name='Wasser_1 Schichtname', related_name='base_shift_sui_shift_name_1',on_delete=models.SET_NULL,blank=True, null=True)
sui_shisetsu_name_1 = models.ForeignKey(Shisetsu, verbose_name='Wasser_1 Einrichtung', related_name='base_shift_sui_shisetsu_name_1',on_delete=models.SET_NULL,blank=True, null=True)
sui_shift_name_2 = models.ForeignKey(Shift, verbose_name='Wasser_2 Schichtname', related_name='base_shift_sui_shift_name_2',on_delete=models.SET_NULL,blank=True, null=True)
sui_shisetsu_name_2 = models.ForeignKey(Shisetsu, verbose_name='Wasser_2 Einrichtungen', related_name='base_shift_sui_shisetsu_name_2',on_delete=models.SET_NULL,blank=True, null=True)
sui_shift_name_3 = models.ForeignKey(Shift, verbose_name='Wasser_3 Schichtname', related_name='base_shift_sui_shift_name_3',on_delete=models.SET_NULL,blank=True, null=True)
sui_shisetsu_name_3 = models.ForeignKey(Shisetsu, verbose_name='Wasser_3 Einrichtungen', related_name='base_shift_sui_shisetsu_name_3',on_delete=models.SET_NULL,blank=True, null=True)
sui_shift_name_4 = models.ForeignKey(Shift, verbose_name='Wasser_4 Schichtname', related_name='base_shift_sui_shift_name_4',on_delete=models.SET_NULL,blank=True, null=True)
sui_shisetsu_name_4 = models.ForeignKey(Shisetsu, verbose_name='Wasser_4 Einrichtungen', related_name='base_shift_sui_shisetsu_name_4',on_delete=models.SET_NULL,blank=True, null=True)
moku_shift_name_1 = models.ForeignKey(Shift, verbose_name='Holz_1 Schichtname', related_name='base_shift_moku_shift_name_1',on_delete=models.SET_NULL,blank=True, null=True)
moku_shisetsu_name_1 = models.ForeignKey(Shisetsu, verbose_name='Holz_1 Einrichtung', related_name='base_shift_moku_shisetsu_name_1',on_delete=models.SET_NULL,blank=True, null=True)
moku_shift_name_2 = models.ForeignKey(Shift, verbose_name='Holz_2 Schichtname', related_name='base_shift_moku_shift_name_2',on_delete=models.SET_NULL,blank=True, null=True)
moku_shisetsu_name_2 = models.ForeignKey(Shisetsu, verbose_name='Holz_2 Einrichtungen', related_name='base_shift_moku_shisetsu_name_2',on_delete=models.SET_NULL,blank=True, null=True)
moku_shift_name_3 = models.ForeignKey(Shift, verbose_name='Holz_3 Schichtname', related_name='base_shift_moku_shift_name_3',on_delete=models.SET_NULL,blank=True, null=True)
moku_shisetsu_name_3 = models.ForeignKey(Shisetsu, verbose_name='Holz_3 Einrichtungen', related_name='base_shift_moku_shisetsu_name_3',on_delete=models.SET_NULL,blank=True, null=True)
moku_shift_name_4 = models.ForeignKey(Shift, verbose_name='Holz_4 Schichtname', related_name='base_shift_moku_shift_name_4',on_delete=models.SET_NULL,blank=True, null=True)
moku_shisetsu_name_4 = models.ForeignKey(Shisetsu, verbose_name='Holz_4 Einrichtungen', related_name='base_shift_moku_shisetsu_name_4',on_delete=models.SET_NULL,blank=True, null=True)
kin_shift_name_1 = models.ForeignKey(Shift, verbose_name='Geld_1 Schichtname', related_name='base_shift_kin_shift_name_1',on_delete=models.SET_NULL,blank=True, null=True)
kin_shisetsu_name_1 = models.ForeignKey(Shisetsu, verbose_name='Geld_1 Einrichtung', related_name='base_shift_kin_shisetsu_name_1',on_delete=models.SET_NULL,blank=True, null=True)
kin_shift_name_2 = models.ForeignKey(Shift, verbose_name='Geld_2 Schichtname', related_name='base_shift_kin_shift_name_2',on_delete=models.SET_NULL,blank=True, null=True)
kin_shisetsu_name_2 = models.ForeignKey(Shisetsu, verbose_name='Geld_2 Einrichtungen', related_name='base_shift_kin_shisetsu_name_2',on_delete=models.SET_NULL,blank=True, null=True)
kin_shift_name_3 = models.ForeignKey(Shift, verbose_name='Geld_3 Schichtname', related_name='base_shift_kin_shift_name_3',on_delete=models.SET_NULL,blank=True, null=True)
kin_shisetsu_name_3 = models.ForeignKey(Shisetsu, verbose_name='Geld_3 Einrichtungen', related_name='base_shift_kin_shisetsu_name_3',on_delete=models.SET_NULL,blank=True, null=True)
kin_shift_name_4 = models.ForeignKey(Shift, verbose_name='Geld_4 Schichtname', related_name='base_shift_kin_shift_name_4',on_delete=models.SET_NULL,blank=True, null=True)
kin_shisetsu_name_4 = models.ForeignKey(Shisetsu, verbose_name='Geld_4 Einrichtungen', related_name='base_shift_kin_shisetsu_name_4',on_delete=models.SET_NULL,blank=True, null=True)
do_shift_name_1 = models.ForeignKey(Shift, verbose_name='Boden_1 Schichtname', related_name='base_shift_do_shift_name_1',on_delete=models.SET_NULL,blank=True, null=True)
do_shisetsu_name_1 = models.ForeignKey(Shisetsu, verbose_name='Boden_1 Einrichtung', related_name='base_shift_do_shisetsu_name_1',on_delete=models.SET_NULL,blank=True, null=True)
do_shift_name_2 = models.ForeignKey(Shift, verbose_name='Boden_2 Schichtname', related_name='base_shift_do_shift_name_2',on_delete=models.SET_NULL,blank=True, null=True)
do_shisetsu_name_2 = models.ForeignKey(Shisetsu, verbose_name='Boden_2 Einrichtungen', related_name='base_shift_do_shisetsu_name_2',on_delete=models.SET_NULL,blank=True, null=True)
do_shift_name_3 = models.ForeignKey(Shift, verbose_name='Boden_3 Schichtname', related_name='base_shift_do_shift_name_3',on_delete=models.SET_NULL,blank=True, null=True)
do_shisetsu_name_3 = models.ForeignKey(Shisetsu, verbose_name='Boden_3 Einrichtungen', related_name='base_shift_do_shisetsu_name_3',on_delete=models.SET_NULL,blank=True, null=True)
do_shift_name_4 = models.ForeignKey(Shift, verbose_name='Boden_4 Schichtname', related_name='base_shift_do_shift_name_4',on_delete=models.SET_NULL,blank=True, null=True)
do_shisetsu_name_4 = models.ForeignKey(Shisetsu, verbose_name='Boden_4 Einrichtungen', related_name='base_shift_do_shisetsu_name_4',on_delete=models.SET_NULL,blank=True, null=True)
nichi_shift_name_1 = models.ForeignKey(Shift, verbose_name='Tag_1 Schichtname', related_name='base_shift_nichi_shift_name_1',on_delete=models.SET_NULL,blank=True, null=True)
nichi_shisetsu_name_1 = models.ForeignKey(Shisetsu, verbose_name='Tag_1 Einrichtung', related_name='base_shift_nichi_shisetsu_name_1',on_delete=models.SET_NULL,blank=True, null=True)
nichi_shift_name_2 = models.ForeignKey(Shift, verbose_name='Tag_2 Schichtname', related_name='base_shift_nichi_shift_name_2',on_delete=models.SET_NULL,blank=True, null=True)
nichi_shisetsu_name_2 = models.ForeignKey(Shisetsu, verbose_name='Tag_2 Einrichtungen', related_name='base_shift_nichi_shisetsu_name_2',on_delete=models.SET_NULL,blank=True, null=True)
nichi_shift_name_3 = models.ForeignKey(Shift, verbose_name='Tag_3 Schichtname', related_name='base_shift_nichi_shift_name_3',on_delete=models.SET_NULL,blank=True, null=True)
nichi_shisetsu_name_3 = models.ForeignKey(Shisetsu, verbose_name='Tag_3 Einrichtungen', related_name='base_shift_nichi_shisetsu_name_3',on_delete=models.SET_NULL,blank=True, null=True)
nichi_shift_name_4 = models.ForeignKey(Shift, verbose_name='Tag_4 Schichtname', related_name='base_shift_nichi_shift_name_4',on_delete=models.SET_NULL,blank=True, null=True)
nichi_shisetsu_name_4 = models.ForeignKey(Shisetsu, verbose_name='Tag_4 Einrichtungen', related_name='base_shift_nichi_shisetsu_name_4',on_delete=models.SET_NULL,blank=True, null=True)
Ich weiß nicht, wie ich es so machen soll, aber wenn Sie die vorherige Methode nicht befolgen, kann dies andere Dinge beeinflussen, also ist es lange her, aber ich habe es mit dieser Methode gemacht.
schedule/views.py
def schedulecreatefunc(request,year_num,month_num):
year, month = int(year_num), int(month_num)
#Löschen Sie alle Zeitpläne des Zieljahres und -monats
Schedule.objects.filter(year = year, month = month).delete()
#Ermitteln Sie die Anzahl der Tage im Schichtbereich
enddate = datetime.date(year,month,20)
startdate = enddate + relativedelta(months=-1)
#Extrahieren Sie die Hoffnung der Zielperiode aus der gewünschten Verschiebung
kiboushift_list = KibouShift.objects.filter(date__range=[startdate, enddate])
kiboushift_list = list(kiboushift_list)
shift_list = Shift.objects.all()
#Reflektieren Sie die gewünschte Verschiebung
for kibou in kiboushift_list:
sum_work_time = 0
for shift in shift_list:
if str(kibou.shift_name_1) == str(shift.name):
sum_work_time = shift.wrok_time + sum_work_time
if str(kibou.shift_name_2) == str(shift.name):
sum_work_time = shift.wrok_time + sum_work_time
if str(kibou.shift_name_3) == str(shift.name):
sum_work_time = shift.wrok_time + sum_work_time
if str(kibou.shift_name_4) == str(shift.name):
sum_work_time = shift.wrok_time + sum_work_time
new_object = Schedule(
user = kibou.user,
date = kibou.date,
year = year,
month = month,
shift_name_1 = kibou.shift_name_1,
shisetsu_name_1 = kibou.shisetsu_name_1,
shift_name_2 = kibou.shift_name_2,
shisetsu_name_2 = kibou.shisetsu_name_2,
shift_name_3 = kibou.shift_name_3,
shisetsu_name_3 = kibou.shisetsu_name_3,
shift_name_4 = kibou.shift_name_4,
shisetsu_name_4 = kibou.shisetsu_name_4,
day_total_worktime = sum_work_time,
)
new_object.save()
#Erstellen Sie eine andere als die gewünschte Schicht
user_list = User.objects.all()
#Ermitteln Sie die Anzahl der Tage im Schichtbereich
enddate = datetime.date(year,month,20)
startdate = enddate + relativedelta(months=-1)
kaisu = enddate - startdate
kaisu = int(kaisu.days)
#Im vergangenen Monat
if month != 1 :
zengetsu = month - 1
else:
zengetsu = 12
year = year - 1
#Prozess für jeden Benutzer
for user in user_list:
#base_Erstellt aus den Informationen, in denen die Schicht registriert ist
base_shift = BaseShift.objects.filter(user = user.id)
kongetsu_list = Schedule.objects.filter(year = year, month = month, user = user.id).order_by('date')
zengetsu_list = Schedule.objects.filter(year = year, month = zengetsu, user = user.id).order_by('date')
sakusei_date = startdate
shift_list = Shift.objects.all()
for new_shift in range(kaisu):
sakusei_date = sakusei_date + timedelta(days=1)
if kongetsu_list.filter(user = user.id, date = sakusei_date).exists():
print("ok")
else:
weekdays = ["Mond","Feuer","Wasser","Holz","Geld","Boden","Tag"]
youbi = weekdays[sakusei_date.weekday()]
#Holen Sie sich aus der Basisschicht und erhalten
if base_shift.filter(user = user.id ).exists():
for base in base_shift:
sum_work_time = 0
shift1 = None
shisetsu1 = None
shift2 = None
shisetsu2 = None
shift3 = None
shisetsu3 = None
shift4 = None
shisetsu4 = None
if youbi == "Mond":
for shift in shift_list:
if str(base.getsu_shift_name_1) == str(shift.name):
shift1 = base.getsu_shift_name_1
shisetsu1 = base.getsu_shisetsu_name_1
sum_work_time = shift.wrok_time + sum_work_time
if str(base.getsu_shift_name_2) == str(shift.name):
shift2 = base.getsu_shift_name_2
shisetsu2 = base.getsu_shisetsu_name_2
sum_work_time = shift.wrok_time + sum_work_time
if str(base.getsu_shift_name_3) == str(shift.name):
shift3 = base.getsu_shift_name_3
shisetsu3 = base.getsu_shisetsu_name_3
sum_work_time = shift.wrok_time + sum_work_time
if str(base.getsu_shift_name_4) == str(shift.name):
shift4 = base.getsu_shift_name_4
shisetsu4 = base.getsu_shisetsu_name_4
sum_work_time = shift.wrok_time + sum_work_time
elif youbi == "Feuer":
for shift in shift_list:
if str(base.ka_shift_name_1) == str(shift.name):
shift1 = base.ka_shift_name_1
shisetsu1 = base.ka_shisetsu_name_1
sum_work_time = shift.wrok_time + sum_work_time
if str(base.ka_shift_name_2) == str(shift.name):
shift2 = base.ka_shift_name_2
shisetsu2 = base.ka_shisetsu_name_2
sum_work_time = shift.wrok_time + sum_work_time
if str(base.ka_shift_name_3) == str(shift.name):
shift3 = base.ka_shift_name_3
shisetsu3 = base.ka_shisetsu_name_3
sum_work_time = shift.wrok_time + sum_work_time
if str(base.ka_shift_name_4) == str(shift.name):
shift4 = base.ka_shift_name_4
shisetsu4 = base.ka_shisetsu_name_4
sum_work_time = shift.wrok_time + sum_work_time
elif youbi == "Wasser":
for shift in shift_list:
if str(base.sui_shift_name_1) == str(shift.name):
shift1 = base.sui_shift_name_1
shisetsu1 = base.sui_shisetsu_name_1
sum_work_time = shift.wrok_time + sum_work_time
if str(base.sui_shift_name_2) == str(shift.name):
shift2 = base.sui_shift_name_2
shisetsu2 = base.sui_shisetsu_name_2
sum_work_time = shift.wrok_time + sum_work_time
if str(base.sui_shift_name_3) == str(shift.name):
shift3 = base.sui_shift_name_3
shisetsu3 = base.sui_shisetsu_name_3
sum_work_time = shift.wrok_time + sum_work_time
if str(base.sui_shift_name_4) == str(shift.name):
shift4 = base.sui_shift_name_4
shisetsu4 = base.sui_shisetsu_name_4
sum_work_time = shift.wrok_time + sum_work_time
elif youbi == "Holz":
for shift in shift_list:
if str(base.moku_shift_name_1) == str(shift.name):
shift1 = base.moku_shift_name_1
shisetsu1 = base.moku_shisetsu_name_1
sum_work_time = shift.wrok_time + sum_work_time
if str(base.moku_shift_name_2) == str(shift.name):
shift2 = base.moku_shift_name_2
shisetsu2 = base.moku_shisetsu_name_2
sum_work_time = shift.wrok_time + sum_work_time
if str(base.moku_shift_name_3) == str(shift.name):
shift3 = base.moku_shift_name_3
shisetsu3 = base.moku_shisetsu_name_3
sum_work_time = shift.wrok_time + sum_work_time
if str(base.moku_shift_name_4) == str(shift.name):
shift4 = base.moku_shift_name_4
shisetsu4 = base.moku_shisetsu_name_4
sum_work_time = shift.wrok_time + sum_work_time
elif youbi == "Geld":
for shift in shift_list:
if str(base.kin_shift_name_1) == str(shift.name):
shift1 = base.kin_shift_name_1
shisetsu1 = base.kin_shisetsu_name_1
sum_work_time = shift.wrok_time + sum_work_time
if str(base.kin_shift_name_2) == str(shift.name):
shift2 = base.kin_shift_name_2
shisetsu2 = base.kin_shisetsu_name_2
sum_work_time = shift.wrok_time + sum_work_time
if str(base.kin_shift_name_3) == str(shift.name):
shift3 = base.kin_shift_name_3
shisetsu3 = base.kin_shisetsu_name_3
sum_work_time = shift.wrok_time + sum_work_time
if str(base.kin_shift_name_4) == str(shift.name):
shift4 = base.kin_shift_name_4
shisetsu4 = base.kin_shisetsu_name_4
sum_work_time = shift.wrok_time + sum_work_time
elif youbi == "Boden":
for shift in shift_list:
if str(base.do_shift_name_1) == str(shift.name):
shift1 = base.do_shift_name_1
shisetsu1 = base.do_shisetsu_name_1
sum_work_time = shift.wrok_time + sum_work_time
if str(base.do_shift_name_2) == str(shift.name):
shift2 = base.do_shift_name_2
shisetsu2 = base.do_shisetsu_name_2
sum_work_time = shift.wrok_time + sum_work_time
if str(base.do_shift_name_3) == str(shift.name):
shift3 = base.do_shift_name_3
shisetsu3 = base.do_shisetsu_name_3
sum_work_time = shift.wrok_time + sum_work_time
if str(base.do_shift_name_4) == str(shift.name):
shift4 = base.do_shift_name_4
shisetsu4 = base.do_shisetsu_name_4
sum_work_time = shift.wrok_time + sum_work_time
if youbi == "Tag":
for shift in shift_list:
if str(base.nichi_shift_name_1) == str(shift.name):
shift1 = base.nichi_shift_name_1
shisetsu1 = base.nichi_shisetsu_name_1
sum_work_time = shift.wrok_time + sum_work_time
if str(base.nichi_shift_name_2) == str(shift.name):
shift2 = base.nichi_shift_name_2
shisetsu2 = base.nichi_shisetsu_name_2
sum_work_time = shift.wrok_time + sum_work_time
if str(base.nichi_shift_name_3) == str(shift.name):
shift3 = base.nichi_shift_name_3
shisetsu3 = base.nichi_shisetsu_name_3
sum_work_time = shift.wrok_time + sum_work_time
if str(base.nichi_shift_name_4) == str(shift.name):
shift4 = base.nichi_shift_name_4
shisetsu4 = base.nichi_shisetsu_name_4
sum_work_time = shift.wrok_time + sum_work_time
new_object=Schedule(
user = base.user,
date = sakusei_date,
year = year,
month = month,
shift_name_1 = shift1,
shisetsu_name_1 = shisetsu1,
shift_name_2 = shift2,
shisetsu_name_2 = shisetsu2,
shift_name_3 = shift3,
shisetsu_name_3 = shisetsu3,
shift_name_4 = shift4,
shisetsu_name_4 = shisetsu4,
day_total_worktime = sum_work_time,
)
new_object.save()
else:
hukushadate = sakusei_date + relativedelta(months=-1)
hukusha_list = zengetsu_list.filter(date = hukushadate, user = user.id)
if zengetsu_list.filter(date = hukushadate, user = user.id).exists():
for hukusha in hukusha_list:
#Berechnen Sie die tägliche Gesamtarbeitszeit aus Schichten
sum_work_time = 0
for shift in shift_list:
if str(hukusha.shift_name_1) == str(shift.name):
sum_work_time = shift.wrok_time + sum_work_time
if str(hukusha.shift_name_2) == str(shift.name):
sum_work_time = shift.wrok_time + sum_work_time
if str(hukusha.shift_name_3) == str(shift.name):
sum_work_time = shift.wrok_time + sum_work_time
if str(hukusha.shift_name_4) == str(shift.name):
sum_work_time = shift.wrok_time + sum_work_time
new_object=Schedule(
user = hukusha.user,
date = sakusei_date,
year = year,
month = month,
shift_name_1 = hukusha.shift_name_1,
shisetsu_name_1 = hukusha.shisetsu_name_1,
shift_name_2 = hukusha.shift_name_2,
shisetsu_name_2 = hukusha.shisetsu_name_2,
shift_name_3 = hukusha.shift_name_3,
shisetsu_name_3 = hukusha.shisetsu_name_3,
shift_name_4 = hukusha.shift_name_4,
shisetsu_name_4 = hukusha.shisetsu_name_4,
day_total_worktime = sum_work_time,
)
new_object.save()
else:
useradd = User.objects.get(id=user.id)
shiftadd = Shift.objects.get(id=2)
new_object=Schedule(
user = useradd,
date = sakusei_date,
year = year,
month = month,
shift_name_1 = shiftadd,
shisetsu_name_1 = None,
shift_name_2 = None,
shisetsu_name_2 = None,
shift_name_3 = None,
shisetsu_name_3 = None,
shift_name_4 = None,
shisetsu_name_4 = None,
day_total_worktime = 0,
)
new_object.save()
return HttpResponseRedirect('/schedule/monthschedule/%s/%s/' % (year,month,))
Wenn BaseShift jetzt registriert ist, wird es zuerst verarbeitet, bevor das Datum des Vormonats kopiert wird.
Organisieren
Dies ist der Status vor der Bearbeitung!
Es hat ein paar Stunden gedauert, aber ich bin froh, dass ich den Vorgang sicher bestätigen konnte!
Recommended Posts