Commit 2cc6c087 authored by RJC's avatar RJC

pulled Dashboard app from dev branch

parent e276ee54
from django.contrib import admin
from .models import Department
class DepartmentAdmin(admin.ModelAdmin):
model = Department
list_display = ('dept_name', 'home_unit')
search_fields = ('dept_name', 'home_unit')
admin.site.register(Department, DepartmentAdmin)
from django.apps import AppConfig
class DashboardConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'Dashboard'
# Generated by Django 4.1.6 on 2023-03-03 15:37
from django.db import migrations, models
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)),
('home_unit', models.CharField(max_length=100)),
],
),
]
from django.db import models
from django.contrib.auth.models import User
class Department(models.Model):
dept_name = models.CharField(max_length=50)
home_unit = models.CharField(max_length=100)
class WidgetUser(User):
pass
<!DOCTYPE HTML>
<HTML>
<Head>
<h1>Welcome to Widget!</h1>
</Head>
<h2>WIDGET USERS</h2>
<ul>
{% for Department in object_list %}
<li>{{Department.dept_name}}, {{Department.home_unit}}</li>
{% endfor %}
</ul>
</HTML>
from django.test import TestCase
# Create your tests here.
from django.urls import path
from .views import DashboardView
urlpatterns = [
path('', DashboardView.as_view()),
]
app_name = "Dashboard"
\ No newline at end of file
from .models import Department
from django.views import generic
class DashboardView(generic.ListView):
model = Department
template_name = 'Dashboard/Dashboard.html'
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