Commit 4ffca08f authored by Almira Redoble's avatar Almira Redoble

Implemented and migrated models

parent a37c4657
# Generated by Django 3.2 on 2023-03-01 01:38
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Department',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('dept_name', models.CharField(default='', max_length=100)),
('home_unit', models.CharField(default='', max_length=100)),
],
),
migrations.CreateModel(
name='WidgetUser',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('first_name', models.CharField(default='', max_length=50)),
('middle_name', models.CharField(default='', max_length=50)),
('last_name', models.CharField(default='', max_length=50)),
('department', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='User', to='dashboard.department')),
],
),
]
from django.db import models
class Department(models.Model):
dept_name = models.CharField(max_length=100, default="")
home_unit = models.CharField(max_length=100, default="")
def __str__(self):
return '{},{}'.format(self.dept_name, self.home_unit)
class WidgetUser(models.Model):
first_name = models.CharField(max_length=50, default="")
middle_name = models.CharField(max_length=50, default="")
last_name = models.CharField(max_length=50, default="")
department = models.ForeignKey(
Department,
on_delete=models.CASCADE,
related_name='User'
)
def __str__(self):
return '{}, {} {}'.format(
self.last_name,
self.first_name,
self.middle_name
)
# Create your models here.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment