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 ...@@ -6,7 +6,7 @@ from .models import Announcement, Reaction
class AnnouncementAdmin(admin.ModelAdmin): class AnnouncementAdmin(admin.ModelAdmin):
model = Announcement model = Announcement
search_fields = ('title','author') search_fields = ('title', 'author')
list_display = ('title', 'author', 'pub_datetime', 'body') list_display = ('title', 'author', 'pub_datetime', 'body')
......
from django.contrib import admin from django.contrib import admin
from .models import Department, WidgetUser from .models import Department, WidgetUser
class DepartmentAdmin(admin.ModelAdmin): class DepartmentAdmin(admin.ModelAdmin):
model = Department model = Department
list_display = ('dept_name', 'home_unit',) list_display = ('dept_name', 'home_unit',)
search_fields = ('dept_name',) search_fields = ('dept_name',)
list_filter = ('home_unit',) list_filter = ('home_unit',)
class UserAdmin(admin.ModelAdmin): class UserAdmin(admin.ModelAdmin):
model = WidgetUser model = WidgetUser
list_display = ('last_name', 'first_name', 'middle_name', 'department',) list_display = ('last_name', 'first_name', 'middle_name', 'department',)
...@@ -16,11 +18,11 @@ class UserAdmin(admin.ModelAdmin): ...@@ -16,11 +18,11 @@ class UserAdmin(admin.ModelAdmin):
fieldsets = [ fieldsets = [
('Name', { ('Name', {
'fields': [ 'fields': [
# the tuple puts these fields in a single line
('last_name', 'first_name', 'middle_name'), 'department' ('last_name', 'first_name', 'middle_name'), 'department'
] ]
}), }),
] ]
admin.site.register(Department, DepartmentAdmin) admin.site.register(Department, DepartmentAdmin)
admin.site.register(WidgetUser, UserAdmin) admin.site.register(WidgetUser, UserAdmin)
...@@ -6,7 +6,7 @@ from .models import WidgetUser ...@@ -6,7 +6,7 @@ from .models import WidgetUser
# Create your views here. # Create your views here.
def index(request): 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') 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]) 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) return HttpResponse(output)
...@@ -18,7 +18,7 @@ from django.urls import include, path ...@@ -18,7 +18,7 @@ from django.urls import include, path
urlpatterns = [ urlpatterns = [
path('dashboard/', include('dashboard.urls', namespace="dashboard")), 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('forum/', include('forum.urls', namespace="forum")),
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