Commit 7f2347d0 authored by Mavrick Jordan Lee's avatar Mavrick Jordan Lee

Added Dashboard in Installed Apps of settings.py. Migrated Models of...

Added Dashboard in Installed Apps of settings.py. Migrated Models of Dashboard. Created Admin Panel for Dashboard.
parent 4db77337
from django.contrib import admin from django.contrib import admin
from .models import Department, WidgetUser
# Register your models here. # Register your models here.
class DepartmentAdmin(admin.ModelAdmin):
model = Department
list_display = ('dept_name', 'home_unit')
search_fields = ('dept_name', 'home_unit')
list_filter = ('dept_name', 'home_unit')
class WidgetUserAdmin(admin.ModelAdmin):
model = WidgetUser
list_display = ('first_name', 'middle_name', 'last_name', 'user_department')
search_fields = ('first_name', 'middle_name', 'last_name', 'user_department')
list_filter = ('first_name', 'middle_name', 'last_name', 'user_department')
admin.site.register(Department, DepartmentAdmin)
admin.site.register(WidgetUser, WidgetUserAdmin)
# Generated by Django 4.1.7 on 2023-03-04 12:26
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(max_length=50, null=True, unique=True)),
('home_unit', models.CharField(max_length=50, null=True, unique=True)),
],
),
migrations.CreateModel(
name='WidgetUser',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('first_name', models.CharField(max_length=30, null=True, unique=True)),
('middle_name', models.CharField(max_length=20, null=True, unique=True)),
('last_name', models.CharField(max_length=20, null=True, unique=True)),
('user_department', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dashboard.department')),
],
),
]
...@@ -31,6 +31,7 @@ ALLOWED_HOSTS = [] ...@@ -31,6 +31,7 @@ ALLOWED_HOSTS = []
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
'dashboard.apps.DashboardConfig',
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',
......
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