Commit 5a021bf3 authored by Carlo Echon's avatar Carlo Echon

Added admin search and filterfor Announcements

parent 5bf0c3c3
......@@ -3,4 +3,8 @@ from django.contrib import admin
# Register your models here.
from .models import Announcement
admin.site.register(Announcement)
\ No newline at end of file
class AnnouncementAdmin(admin.ModelAdmin):
model = Announcement
search_fields = ['announcement_title', 'announcement_body']
list_display = ('announcement_title', 'announcement_body', 'pub_date')
admin.site.register(Announcement, AnnouncementAdmin)
\ No newline at end of file
......@@ -3,7 +3,7 @@ from django.db import models
# Create your models here.
class Announcement(models.Model):
announcement_title = models.CharField(max_length=50)
announcement_body = models.CharField(max_length=500)
announcement_body = models.TextField(max_length=1500)
pub_date = models.DateTimeField("date published")
def __str__(self):
......
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