Commit 7ee2e782 authored by Brescia Amandy's avatar Brescia Amandy

Populated database

parent 092c1887
from django.contrib import admin from django.contrib import admin
from .models import Reaction,Announcement from .models import Reaction, Announcement
# Register your models here. # Register your models here.
class ReactionInLine(admin.TabularInline): class ReactionAdmin(admin.ModelAdmin):
model = Reaction model = Reaction
extra = 1 extra = 1
class AnnouncementAdmin(admin.ModelAdmin): class AnnouncementAdmin(admin.ModelAdmin):
inlines = [ReactionInLine,]
list_display = ('title', 'author', 'pub_datetime', 'body') list_display = ('title', 'author', 'pub_datetime', 'body')
search_fields = ('title', 'author', 'body') search_fields = ('title', 'author', 'body')
list_filter = ('author', 'pub_datetime') list_filter = ('author', 'pub_datetime')
admin.site.register(Announcement, AnnouncementAdmin)
admin.site.register(Reaction, ReactionAdmin)
\ No newline at end of file
# Generated by Django 3.2 on 2023-03-06 14:55
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(max_length=50)),
('body', models.TextField()),
('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(max_length=50)),
('tally', models.IntegerField()),
('announcement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Announcement_Board.announcement')),
],
),
]
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
from dashboard.model import WidgetUser from dashboard.models import WidgetUser
# Create your models here. # Create your models here.
......
# Generated by Django 3.2 on 2023-03-06 14:55
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0001_initial'),
('forum', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='forumpost',
name='author',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dashboard.widgetuser'),
),
]
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
from dashboard.model import WidgetUser from dashboard.models import WidgetUser
# Create your models here. # Create your models here.
class ForumPost(models.Model): class ForumPost(models.Model):
......
...@@ -11,10 +11,7 @@ https://docs.djangoproject.com/en/4.1/ref/settings/ ...@@ -11,10 +11,7 @@ https://docs.djangoproject.com/en/4.1/ref/settings/
""" """
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
import os
from pathlib import Path from pathlib import Path
from dotenv import load_dotenv
load_dotenv() load_dotenv()
......
...@@ -16,10 +16,11 @@ Including another URLconf ...@@ -16,10 +16,11 @@ Including another URLconf
from django.contrib import admin from django.contrib import admin
from django.urls import include, path from django.urls import include, path
urlpatterns = [ urlpatterns = [
path('forum/', include('forum.urls', namespace="forum" )), path('forum/', include(('forum.urls', 'forum'), namespace="forum" )),
path('assignments/', include('assignments.urls', namespace="assignments")), path('assignments/', include(('assignments.urls', 'assignments'), namespace="assignments")),
path('Announcement_Board/', include('Announcement_Board.urls', namespace="Announcement_Board" )), path('Announcement_Board/', include(('Announcement_Board.urls', 'Announcement_Board'), namespace="Announcement_Board")),
path('dashboard', include('dashboard.urls', namespace="dashboard")), path('dashboard', include(('dashboard.urls', 'dashboard'), namespace="dashboard")),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
] ]
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