Commit 6f2412e0 authored by Nics De Vega's avatar Nics De Vega

created admin panel, populated announcement models

parent 62530d3d
from django.contrib import admin from django.contrib import admin
from .models import Announcement, Reaction
# Register your models here. class AnnouncementAdmin(admin.ModelAdmin):
model = Announcement
list_dsiplay = ("title","body","author","pub_datetime")
search_fields = ("title", "author")
list_filter = ("title","author")
class ReactionAdmin(admin.ModelAdmin):
model = Reaction
list_dsiplay = ("name","tally","announcement")
search_fields = ("name","announcement")
list_filter = ("name","announcement")
admin.site.register(Announcement,AnnouncementAdmin)
admin.site.register(Reaction,ReactionAdmin)
# Generated by Django 4.1.7 on 2023-03-06 03:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('dashboard', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Announcement',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(default='', max_length=100)),
('body', models.TextField(default='')),
('pub_datetime', models.DateTimeField()),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dashboard.widgetuser')),
],
),
migrations.CreateModel(
name='Reaction',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(choices=[('Like', 'Like'), ('Love', 'Love'), ('Angry', 'Angry')], max_length=6)),
('tally', models.IntegerField(default=0)),
('announcement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='announcement_board.announcement')),
],
),
]
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