Commit bbbccaa1 authored by John Tamano's avatar John Tamano

Added Department model and Widget User model fields[MIDTERMS]

parent 4d5b8d2d
from tkinter import Widget from tkinter import Widget
from django.contrib import admin from django.contrib import admin
from .models import WidgetUser from .models import Department, WidgetUser
class WidgetUserAdmin(admin.ModelAdmin): class WidgetUserAdmin(admin.ModelAdmin):
model = WidgetUser model = WidgetUser
# Register your models here. # Register your models here.
class DepartmentAdmin(admin.ModelAdmin):
model = Department
admin.site.register(WidgetUser, WidgetUserAdmin) admin.site.register(WidgetUser, WidgetUserAdmin)
admin.site.register(Department, DepartmentAdmin)
# Generated by Django 4.0.3 on 2022-03-23 03:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='widgetuser',
name='email',
field=models.EmailField(default='Somebody@obf.ateneo.edu', max_length=200),
),
migrations.AddField(
model_name='widgetuser',
name='id_num',
field=models.IntegerField(default=193000, max_length=7),
),
]
# Generated by Django 4.0.3 on 2022-03-23 03:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0002_widgetuser_email_widgetuser_id_num'),
]
operations = [
migrations.AlterField(
model_name='widgetuser',
name='id_num',
field=models.CharField(default='193000', max_length=7),
),
]
# Generated by Django 4.0.3 on 2022-03-23 03:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('homepage', '0003_alter_widgetuser_id_num'),
]
operations = [
migrations.CreateModel(
name='Department',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('dept_name', models.CharField(max_length=200)),
('home_unit', models.CharField(max_length=200)),
('widgetuser', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='homepage.widgetuser')),
],
),
]
# Generated by Django 4.0.3 on 2022-03-23 04:09
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('homepage', '0004_department'),
]
operations = [
migrations.RemoveField(
model_name='department',
name='widgetuser',
),
]
# Generated by Django 4.0.3 on 2022-03-23 04:22
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('homepage', '0005_remove_department_widgetuser'),
]
operations = [
migrations.AddField(
model_name='widgetuser',
name='department',
field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to='homepage.department'),
),
]
from pyexpat import model from pyexpat import model
from tkinter import Widget
from django.db import models from django.db import models
class Department(models.Model):
dept_name = models.CharField(max_length=200)
home_unit = models.CharField(max_length=200)
def __str__(self):
return'{}'.format(self.dept_name)
class WidgetUser(models.Model): class WidgetUser(models.Model):
first_name = models.CharField(max_length=75) first_name = models.CharField(max_length=75)
middle_name = models.CharField(max_length=75) middle_name = models.CharField(max_length=75)
last_name = models.CharField(max_length=75) last_name = models.CharField(max_length=75)
id_num = models.CharField(max_length=7, default='193000')
email = models.EmailField(max_length=200, default='Somebody@obf.ateneo.edu')
department = models.ForeignKey(Department,
on_delete=models.CASCADE,
default = None
)
def __str__(self): def __str__(self):
return'{}'.format(self.first_name) return'{}'.format(self.first_name)
# Create your models here. # Create your models here.
\ No newline at end of file
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