Commit b2edace6 authored by Ian Rafael T. Aragoza's avatar Ian Rafael T. Aragoza

Add Department and WidgetUser models to dashboard app

parent bc03bf5e
Pipeline #2930 canceled with stages
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class AnnouncementboardConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'announcementboard'
from django.db import models
# Create your models here.
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
from django.urls import path
from .views import index
# Create your views here.
urlpatterns = [
path('', index, name='index'),
]
app_name = "announcementboard"
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
return HttpResponse('Announcement Board app.')
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class DashboardConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'dashboard'
# Generated by Django 4.1.7 on 2023-03-04 11:37
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=48, unique=True)),
('home_unit', models.CharField(max_length=48)),
],
),
migrations.CreateModel(
name='WidgetUser',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('first_name', models.TextField()),
('middle_name', models.TextField()),
('last_name', models.TextField()),
('department', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='department', to='dashboard.department')),
],
),
]
# Generated by Django 4.1.7 on 2023-03-04 11:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='widgetuser',
name='first_name',
field=models.TextField(max_length=48),
),
migrations.AlterField(
model_name='widgetuser',
name='last_name',
field=models.TextField(max_length=48),
),
migrations.AlterField(
model_name='widgetuser',
name='middle_name',
field=models.TextField(max_length=48),
),
]
from django.db import models
# Create your models here.
from django.db import models
from django.urls import reverse
class Department(models.Model):
dept_name = models.CharField(max_length=48, unique=True)
home_unit = models.CharField(max_length=48)
def __str__(self):
return '{}'.format(self.dept_name)
def get_absolute_url(self):
return reverse('department_detail', args=[str(self.dept_name)])
class WidgetUser(models.Model):
first_name = models.TextField(max_length=48)
middle_name = models.TextField(max_length=48)
last_name = models.TextField(max_length=48)
department = models.ForeignKey(Department, on_delete=models.CASCADE, related_name='department')
def __str__(self):
return '{}, {} {}'.format(self.last_name, self.first_name, self.middle_name)
def get_absolute_url(self):
return reverse('user_detail', args=[str(self.last_name)])
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
from django.urls import path
from .views import index
# Create your views here.
urlpatterns = [
path('', index, name='index'),
]
app_name = "dashboard"
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
return HttpResponse('Dashboard app.')
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class ForumConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'forum'
from django.db import models
# Create your models here.
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
from django.urls import path
from .views import index
# Create your views here.
urlpatterns = [
path('', index, name='index'),
]
app_name = "forum"
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
return HttpResponse('Forum app.')
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