Commit 315f6a32 authored by Ian Rafael T. Aragoza's avatar Ian Rafael T. Aragoza

Update README.txt, clean more code to PEP8 standards, change announcementboard app URL

parent 3fcde7bc
......@@ -6,7 +6,7 @@ from .models import Announcement, Reaction
class AnnouncementAdmin(admin.ModelAdmin):
model = Announcement
search_fields = ('title','author')
search_fields = ('title', 'author')
list_display = ('title', 'author', 'pub_datetime', 'body')
......@@ -21,4 +21,4 @@ class ReactionAdmin(admin.ModelAdmin):
# Register your models here.
admin.site.register(Announcement, AnnouncementAdmin)
admin.site.register(Reaction, ReactionAdmin)
\ No newline at end of file
admin.site.register(Reaction, ReactionAdmin)
......@@ -9,7 +9,7 @@ class Announcement(models.Model):
title = models.CharField(max_length=255)
body = models.TextField()
author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE, related_name="announcements")
pub_datetime = models.DateTimeField(verbose_name="Posted On", auto_now_add=True)
pub_datetime = models.DateTimeField(verbose_name="Posted On", auto_now_add=True)
def __str__(self):
return '{}'.format(self.title)
......
......@@ -7,4 +7,4 @@ urlpatterns = [
path('', index, name='index'),
]
app_name = "announcementboard"
\ No newline at end of file
app_name = "announcementboard"
from django.contrib import admin
from .models import Department, WidgetUser
class DepartmentAdmin(admin.ModelAdmin):
model = Department
list_display = ('dept_name', 'home_unit',)
search_fields = ('dept_name',)
list_filter = ('home_unit',)
class UserAdmin(admin.ModelAdmin):
model = WidgetUser
list_display = ('last_name', 'first_name', 'middle_name', 'department',)
......@@ -14,13 +16,13 @@ class UserAdmin(admin.ModelAdmin):
list_filter = ('department',)
fieldsets = [
('Name', {
'fields': [
# the tuple puts these fields in a single line
('last_name', 'first_name', 'middle_name'), 'department'
('Name', {
'fields': [
('last_name', 'first_name', 'middle_name'), 'department'
]
}),
]
admin.site.register(Department, DepartmentAdmin)
admin.site.register(WidgetUser, UserAdmin)
\ No newline at end of file
admin.site.register(WidgetUser, UserAdmin)
......@@ -7,4 +7,4 @@ urlpatterns = [
path('', index, name='index'),
]
app_name = "dashboard"
\ No newline at end of file
app_name = "dashboard"
......@@ -6,7 +6,7 @@ from .models import WidgetUser
# Create your views here.
def index(request):
output = "Welcome to Widget!<br><br> WIDGET USERS:<br>"
output = "<h1>Welcome to Widget!</h1><h3>WIDGET USERS:</h3>"
userList = WidgetUser.objects.order_by('last_name')
output += '<br>'.join(['{}, {} {}: {}, {}'.format(user.last_name, user.first_name, user.middle_name, user.department, user.department.home_unit) for user in userList])
return HttpResponse(output)
......@@ -18,7 +18,7 @@ from django.urls import include, path
urlpatterns = [
path('dashboard/', include('dashboard.urls', namespace="dashboard")),
path('announcementboard/', include('announcementboard.urls', namespace="announcementboard")),
path('announcements/', include('announcementboard.urls', namespace="announcements")),
path('forum/', include('forum.urls', namespace="forum")),
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