added inserting into db

This commit is contained in:
s457957 2020-12-05 22:37:19 +01:00
parent 76fe8f7b7f
commit 5055ef9b5b
11 changed files with 120 additions and 178 deletions

View File

@ -1,6 +1,8 @@
# Generated by Django 3.1.3 on 2020-11-23 19:33
# Generated by Django 3.1.3 on 2020-12-05 16:44
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
@ -8,55 +10,54 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Employee',
name='TimeModel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('first_name', models.CharField(max_length=200)),
('last_name', models.CharField(max_length=200)),
('department', models.CharField(max_length=200)),
('manager_id', models.IntegerField()),
('time_model_id', models.IntegerField()),
('manager_flag', models.BooleanField()),
],
),
migrations.CreateModel(
name='Plan',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('person_id', models.IntegerField(unique=True)),
('date', models.DateField()),
('begin_time', models.TimeField()),
('end_time', models.TimeField()),
('time_model_id', models.IntegerField(primary_key=True, serialize=False)),
('weekly_hours', models.DecimalField(decimal_places=2, max_digits=4)),
('weekly_days', models.IntegerField()),
('mon', models.IntegerField()),
('tue', models.IntegerField()),
('wed', models.IntegerField()),
('thu', models.IntegerField()),
('fri', models.IntegerField()),
('sat', models.IntegerField()),
('sun', models.IntegerField()),
],
),
migrations.CreateModel(
name='TimeLog',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('person_id', models.IntegerField(unique=True)),
('date', models.DateField()),
('begin_time', models.TimeField()),
('end_time', models.TimeField()),
('username', models.OneToOneField(default='', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='TimeModel',
name='Plan',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date', models.DateField()),
('begin_time', models.TimeField()),
('end_time', models.TimeField()),
('username', models.OneToOneField(default='', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Employee',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('department', models.CharField(max_length=200)),
('manager_username', models.CharField(max_length=200)),
('time_model_id', models.IntegerField()),
('weekly_hours', models.DecimalField(decimal_places=2, max_digits=2)),
('weekly_days', models.IntegerField()),
('mon', models.BooleanField()),
('tue', models.BooleanField()),
('wed', models.BooleanField()),
('thu', models.BooleanField()),
('fri', models.BooleanField()),
('sat', models.BooleanField()),
('sun', models.BooleanField()),
('manager_flag', models.IntegerField()),
('username', models.OneToOneField(default='', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]

View File

@ -1,18 +0,0 @@
# Generated by Django 3.1.3 on 2020-11-23 19:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hr_module', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='timemodel',
name='weekly_hours',
field=models.DecimalField(decimal_places=2, max_digits=4),
),
]

View File

@ -0,0 +1,23 @@
# Generated by Django 3.1.3 on 2020-12-05 21:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hr_module', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='plan',
name='username',
field=models.CharField(default='', max_length=100),
),
migrations.AlterField(
model_name='timelog',
name='username',
field=models.CharField(default='', max_length=100),
),
]

View File

@ -1,18 +0,0 @@
# Generated by Django 3.1.3 on 2020-11-23 19:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hr_module', '0002_auto_20201123_1941'),
]
operations = [
migrations.AlterField(
model_name='timemodel',
name='time_model_id',
field=models.IntegerField(unique=True),
),
]

View File

@ -0,0 +1,18 @@
# Generated by Django 3.1.3 on 2020-12-05 21:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hr_module', '0002_auto_20201205_2123'),
]
operations = [
migrations.AlterField(
model_name='employee',
name='username',
field=models.CharField(max_length=200),
),
]

View File

@ -1,22 +0,0 @@
# Generated by Django 3.1.3 on 2020-11-23 19:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hr_module', '0003_auto_20201123_1943'),
]
operations = [
migrations.RemoveField(
model_name='timemodel',
name='id',
),
migrations.AlterField(
model_name='timemodel',
name='time_model_id',
field=models.IntegerField(primary_key=True, serialize=False),
),
]

View File

@ -0,0 +1,25 @@
# Generated by Django 3.1.3 on 2020-12-05 21:36
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('hr_module', '0003_auto_20201205_2124'),
]
operations = [
migrations.RemoveField(
model_name='employee',
name='id',
),
migrations.AlterField(
model_name='employee',
name='username',
field=models.OneToOneField(default='', on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL),
),
]

View File

@ -1,53 +0,0 @@
# Generated by Django 3.1.3 on 2020-11-29 18:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hr_module', '0004_auto_20201123_1943'),
]
operations = [
migrations.AlterField(
model_name='employee',
name='manager_flag',
field=models.IntegerField(),
),
migrations.AlterField(
model_name='timemodel',
name='fri',
field=models.IntegerField(),
),
migrations.AlterField(
model_name='timemodel',
name='mon',
field=models.IntegerField(),
),
migrations.AlterField(
model_name='timemodel',
name='sat',
field=models.IntegerField(),
),
migrations.AlterField(
model_name='timemodel',
name='sun',
field=models.IntegerField(),
),
migrations.AlterField(
model_name='timemodel',
name='thu',
field=models.IntegerField(),
),
migrations.AlterField(
model_name='timemodel',
name='tue',
field=models.IntegerField(),
),
migrations.AlterField(
model_name='timemodel',
name='wed',
field=models.IntegerField(),
),
]

View File

@ -1,18 +0,0 @@
# Generated by Django 3.1.3 on 2020-12-01 21:18
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('hr_module', '0005_auto_20201129_1838'),
]
operations = [
migrations.RenameField(
model_name='employee',
old_name='manager_id',
new_name='manager_number',
),
]

View File

@ -1,19 +0,0 @@
# Generated by Django 3.1.3 on 2020-12-01 21:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hr_module', '0006_auto_20201201_2118'),
]
operations = [
migrations.AddField(
model_name='employee',
name='person_identifier',
field=models.CharField(default=0, max_length=200),
preserve_default=False,
),
]

23
temp/import_file.csv Normal file
View File

@ -0,0 +1,23 @@
,first_name,last_name,email,is_staff,is_active,is_superuser,department,manager_username,time_model_id,manager_flag
0,test,test2,testtest2@fff.com,False,True,False,test department,93099,10,0
1,test,sf,testsf@fff.com,False,True,False,test department,123555,5,0
2,test,fsdc,testfsdc@fff.com,False,True,False,dfdfdv,58347,14,0
3,test,sdvcds,testsdvcds@fff.com,False,True,False,fsdfgfg,21411,11,0
4,test,vsd,testvsd@fff.com,False,True,False,fg,100670,14,0
5,gf,ddsf,gfddsf@fff.com,False,True,False,fsdfgfg,56776,1,1
6,fg,bg,fgbg@fff.com,False,True,False,fg,1012,7,1
7,gf,gb,gfgb@fff.com,False,True,False,fsdfgfg,24615,6,1
8,fg,gb,fggb@fff.com,False,True,False,dfgdfgffgs,131029,10,1
9,fg,gf,fggf@fff.com,False,True,False,fsdfgfg,150186,6,1
10,gf,bfg,gfbfg@fff.com,False,True,False,sfgdfsgdfg,127720,7,0
11,dfg,bvdf,dfgbvdf@fff.com,False,True,False,test department,21584,13,1
12,fg,test2,fgtest2@fff.com,False,True,False,test department,106721,6,0
13,first_name,bfg,first_namebfg@fff.com,False,True,False,test department,151398,10,0
14,dfg,test2,dfgtest2@fff.com,False,True,False,test department,18196,1,0
15,gf,gbb,gfgbb@fff.com,False,True,False,fsdfgfg,23266,11,0
16,dfg,fd,dfgfd@fff.com,False,True,False,fsdfgfg,109517,15,0
17,gf,bsdgbdf,gfbsdgbdf@fff.com,False,True,False,fsdfgfg,56302,13,1
18,gf,fd,gffd@fff.com,False,True,False,fsdfgfg,149169,11,1
19,dfg,gdf,dfggdf@fff.com,False,True,False,fsdfgfg,83458,3,0
20,dfg,gb,dfggb@fff.com,False,True,False,fsdfgfg,12670,6,0
21,test,test2,testtest2@fff.com,False,True,False,test department,49135,3,1
1 first_name last_name email is_staff is_active is_superuser department manager_username time_model_id manager_flag
2 0 test test2 testtest2@fff.com False True False test department 93099 10 0
3 1 test sf testsf@fff.com False True False test department 123555 5 0
4 2 test fsdc testfsdc@fff.com False True False dfdfdv 58347 14 0
5 3 test sdvcds testsdvcds@fff.com False True False fsdfgfg 21411 11 0
6 4 test vsd testvsd@fff.com False True False fg 100670 14 0
7 5 gf ddsf gfddsf@fff.com False True False fsdfgfg 56776 1 1
8 6 fg bg fgbg@fff.com False True False fg 1012 7 1
9 7 gf gb gfgb@fff.com False True False fsdfgfg 24615 6 1
10 8 fg gb fggb@fff.com False True False dfgdfgffgs 131029 10 1
11 9 fg gf fggf@fff.com False True False fsdfgfg 150186 6 1
12 10 gf bfg gfbfg@fff.com False True False sfgdfsgdfg 127720 7 0
13 11 dfg bvdf dfgbvdf@fff.com False True False test department 21584 13 1
14 12 fg test2 fgtest2@fff.com False True False test department 106721 6 0
15 13 first_name bfg first_namebfg@fff.com False True False test department 151398 10 0
16 14 dfg test2 dfgtest2@fff.com False True False test department 18196 1 0
17 15 gf gbb gfgbb@fff.com False True False fsdfgfg 23266 11 0
18 16 dfg fd dfgfd@fff.com False True False fsdfgfg 109517 15 0
19 17 gf bsdgbdf gfbsdgbdf@fff.com False True False fsdfgfg 56302 13 1
20 18 gf fd gffd@fff.com False True False fsdfgfg 149169 11 1
21 19 dfg gdf dfggdf@fff.com False True False fsdfgfg 83458 3 0
22 20 dfg gb dfggb@fff.com False True False fsdfgfg 12670 6 0
23 21 test test2 testtest2@fff.com False True False test department 49135 3 1