Created initial user and some sample report objects. Initialized superuser to admin/admin
This commit is contained in:
parent
bd1bf44059
commit
63f3465ca4
6 changed files with 202 additions and 1 deletions
|
@ -1,3 +1,12 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from .models import *
|
||||||
|
|
||||||
# Register your models here.
|
admin.site.register(Report)
|
||||||
|
admin.site.register(Section)
|
||||||
|
admin.site.register(Field)
|
||||||
|
admin.site.register(DataBool)
|
||||||
|
admin.site.register(DataDecimal)
|
||||||
|
admin.site.register(DataDate)
|
||||||
|
admin.site.register(DataFile)
|
||||||
|
admin.site.register(DataString)
|
||||||
|
admin.site.register(DataInteger)
|
||||||
|
|
88
back/backend/migrations/0001_initial.py
Normal file
88
back/backend/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
# Generated by Django 2.1.5 on 2019-01-23 00:38
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='DataBool',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('data', models.BooleanField(default=False)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='DataDate',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('data', models.DateField(blank=True, null=True)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='DataDecimal',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('data', models.DecimalField(blank=True, decimal_places=2, max_digits=9, null=True)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='DataFile',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('data', models.FileField(blank=True, null=True, upload_to='')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='DataInteger',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('data', models.IntegerField(blank=True, null=True)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='DataString',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('data', models.TextField(default='')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Field',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('label', models.CharField(max_length=256)),
|
||||||
|
('number', models.IntegerField()),
|
||||||
|
('type', models.CharField(max_length=128)),
|
||||||
|
('completed', models.BooleanField(default=False)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Report',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('title', models.CharField(max_length=128)),
|
||||||
|
('date_created', models.DateTimeField(verbose_name='date created')),
|
||||||
|
('date_submitted', models.DateTimeField(blank=True, null=True, verbose_name='date submitted')),
|
||||||
|
('submitted', models.BooleanField(default=False)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Section',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('completed', models.BooleanField()),
|
||||||
|
('title', models.CharField(max_length=256)),
|
||||||
|
('html_description', models.TextField()),
|
||||||
|
('number', models.IntegerField()),
|
||||||
|
('report_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Report')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
58
back/backend/migrations/0002_auto_20190123_0038.py
Normal file
58
back/backend/migrations/0002_auto_20190123_0038.py
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
# Generated by Django 2.1.5 on 2019-01-23 00:38
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
('backend', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='report',
|
||||||
|
name='user_id',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='field',
|
||||||
|
name='section_id',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Section'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='datastring',
|
||||||
|
name='field_id',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Field'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='datainteger',
|
||||||
|
name='field_id',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Field'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='datafile',
|
||||||
|
name='field_id',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Field'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='datadecimal',
|
||||||
|
name='field_id',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Field'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='datadate',
|
||||||
|
name='field_id',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Field'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='databool',
|
||||||
|
name='field_id',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Field'),
|
||||||
|
),
|
||||||
|
]
|
BIN
back/db.sqlite3
Normal file
BIN
back/db.sqlite3
Normal file
Binary file not shown.
|
@ -8,5 +8,6 @@ class CustomUserAdmin(UserAdmin):
|
||||||
add_form = CustomUserCreationForm
|
add_form = CustomUserCreationForm
|
||||||
form = CustomUserChangeForm
|
form = CustomUserChangeForm
|
||||||
model = CustomUser
|
model = CustomUser
|
||||||
|
list_display = ['username', 'email', 'first_name', 'last_name']
|
||||||
|
|
||||||
admin.site.register(CustomUser, CustomUserAdmin)
|
admin.site.register(CustomUser, CustomUserAdmin)
|
||||||
|
|
45
back/users/migrations/0001_initial.py
Normal file
45
back/users/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
# Generated by Django 2.1.5 on 2019-01-23 00:38
|
||||||
|
|
||||||
|
import django.contrib.auth.models
|
||||||
|
import django.contrib.auth.validators
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.utils.timezone
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('auth', '0009_alter_user_last_name_max_length'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='CustomUser',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('password', models.CharField(max_length=128, verbose_name='password')),
|
||||||
|
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
|
||||||
|
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
|
||||||
|
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
|
||||||
|
('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
|
||||||
|
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
|
||||||
|
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
|
||||||
|
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
|
||||||
|
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
|
||||||
|
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
|
||||||
|
('age', models.PositiveIntegerField(blank=True, null=True)),
|
||||||
|
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
|
||||||
|
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name': 'user',
|
||||||
|
'verbose_name_plural': 'users',
|
||||||
|
'abstract': False,
|
||||||
|
},
|
||||||
|
managers=[
|
||||||
|
('objects', django.contrib.auth.models.UserManager()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
Loading…
Reference in a new issue