Commit 9f79d6ea authored by iceman2434's avatar iceman2434

Added ForumAdmin, updated model functions

parent c04d0a33
from django.contrib import admin from django.contrib import admin
from .models import Forum
#from .models import WidgetUser, Announcement, Post, Assignment
\ No newline at end of file class ForumAdmin(admin.ModelAdmin):
model = Forum
search_fields = ('post_title', 'post_body', 'pub_date')
list_display = ('post_title', 'post_body', 'pub_date')
list_filter = ('post_title', 'post_body', 'pub_date')
fieldsets = [
('Forum Data', {
'fields': [
'post_title',
'list_display',
'list_filter'
]
}),
]
admin.site.register(Forum, ForumAdmin)
...@@ -10,3 +10,6 @@ class Forum(models.Model): ...@@ -10,3 +10,6 @@ class Forum(models.Model):
def __str__(self): def __str__(self):
return self.post_title return self.post_title
def get_absolute_url(self):
return reverse('forum', args=[(self.post_title)])
...@@ -40,6 +40,7 @@ INSTALLED_APPS = [ ...@@ -40,6 +40,7 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'widget_group3',
] ]
MIDDLEWARE = [ MIDDLEWARE = [
......
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