The code starts below, specifically for models and views -
class userchoice(models.Model):
choice = []
choice2 = list(userdata.objects.all().values_list('key'))
for x in choice2:
for t in x:
choice.append((t,t.capitalize()))
Job_ID = models.CharField(primary_key = True, max_length=200, choices=choice, default='key')
Group_ID= models.CharField(max_length=200, choices=choice, default='key')
Customer_name = models.CharField(max_length=200, choices=choice, default='key')
Planned_Duration = models.CharField(max_length=200, choices=choice, default='key')
Worker_name = models.CharField(max_length=200, choices=choice, default='key')
Job_note = models.CharField(max_length=200, choices=choice, default='key')
Customer_tp_name = models.CharField(max_length=200, choices=choice, default='key')
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('csvfileapp', '0008_userdata'),
]
operations = [
migrations.CreateModel(
name='userchoice',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('Job_ID', models.CharField(default='key', max_length=200)),
('Group_ID', models.CharField(default='key', max_length=200)),
('Customer_name', models.CharField(default='key', max_length=200)),
('Planned_Duration', models.CharField(default='key', max_length=200)),
('Worker_name', models.CharField(default='key', max_length=200)),
('Job_note', models.CharField(default='key', max_length=200)),
('Customer_tp_name', models.CharField(default='key', max_length=200)),
],
),
]