Commit 76fb520d authored by Ron Rodillas's avatar Ron Rodillas

fixed issues with the forum models not working

parent 225847b0
No preview for this file type
......@@ -6,11 +6,13 @@ class ForumPostAdmin(admin.ModelAdmin):
model = ForumPost
list_display = ('title', 'author', 'pub_datetime')
search_fields = ('title', 'author')
list_filter = ('pub_datetime')
list_filter = ('pub_datetime',)
class ReplyAdmin(admin.ModelAdmin):
model = Reply
list_display = ('author', 'pub_datetime')
search_fields = ('author')
list_filter = ('pub_datetime')
\ No newline at end of file
search_fields = ('author',)
list_filter = ('pub_datetime',)
admin.site.register(ForumPost, ForumPostAdmin)
admin.site.register(Reply,ReplyAdmin)
\ No newline at end of file
# Generated by Django 4.1.7 on 2023-03-05 07:32
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ForumPost',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=100)),
('body', models.TextField()),
('author', models.CharField(max_length=100)),
('pub_datetime', models.DateTimeField(auto_now_add=True)),
],
),
migrations.CreateModel(
name='Reply',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('body', models.TextField()),
('author', models.CharField(max_length=100)),
('pub_datetime', models.DateTimeField(auto_now_add=True)),
],
),
]
from django.db import models
# Create your models here.
class ForumPost (models.model):
class ForumPost (models.Model):
title = models.CharField(max_length=100)
body = models.TextField()
author = models.CharField(max_length=100)
pub_datetime = models.DateTimeField(auto_now_add=True)
class Reply (models.model):
class Reply (models.Model):
body = models.TextField()
author = models.CharField(max_length=100)
pub_datetime = models.DateTimeField(auto_now_add=True)
\ No newline at end of file
from django.urls import path
from .views import index
urlpatterns = [
path('', index, name='index'),
]
app_name="forum"
\ No newline at end of file
......@@ -11,6 +11,9 @@ https://docs.djangoproject.com/en/4.1/ref/settings/
"""
from pathlib import Path
from dotenv import load_dotenv
import os
load_dotenv()
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
......@@ -37,6 +40,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'forum',
]
MIDDLEWARE = [
......
......@@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import include, path
urlpatterns = [
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