Add Department model to homepage

parent 8d787d68
from django.contrib import admin
from .models import WidgetUser
from .models import WidgetUser, Department
class WidgetUserAdmin(admin.ModelAdmin):
......@@ -8,4 +8,10 @@ class WidgetUserAdmin(admin.ModelAdmin):
search_fields = ['first_name', 'middle_name', 'last_name', 'id_num', 'email']
list_display = ('first_name', 'middle_name', 'last_name', 'id_num', 'email')
class DepartmentAdmin(admin.ModelAdmin):
model = Department
search_fields = ['dept_name', 'home_unit']
list_display = ('dept_name', 'home_unit')
admin.site.register(WidgetUser, WidgetUserAdmin)
admin.site.register(Department, DepartmentAdmin)
\ No newline at end of file
# Generated by Django 4.0.3 on 2022-04-02 09:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0002_widgetuser_email_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=100)),
('home_unit', models.CharField(max_length=150)),
],
),
]
......@@ -10,3 +10,10 @@ class WidgetUser(models.Model):
def __str__(self):
return self.id_num
class Department(models.Model):
dept_name = models.CharField(max_length=100)
home_unit = models.CharField(max_length=150)
def __str__(self):
return self.dept_name
\ 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