Skip to content

Commit

Permalink
Health dashboard (#29)
Browse files Browse the repository at this point in the history
* created HealthInfo admin and model -- not working

* created health dashboard in admin view

* updated migrations

---------

Co-authored-by: johnlhuangP <[email protected]>
  • Loading branch information
charlestang06 and johnlhuangP authored Oct 31, 2024
1 parent f1e6c7a commit e3430f4
Show file tree
Hide file tree
Showing 9 changed files with 371 additions and 579 deletions.
30 changes: 16 additions & 14 deletions necysc_app/admin.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
# admin.py
from django.contrib import admin
from .models import Applicant
from .models import GlobalData
from .models import Applicant, ApplicantHealth, GlobalData
from solo.admin import SingletonModelAdmin

class ApplicantAdmin(admin.ModelAdmin):
# allows search by first name or last name
search_fields = ['applicant_fname', 'applicant_lname']
list_display = ['applicant_fname', 'applicant_lname', 'applicant_bday', 'last_updated_at',
'program', 'group_id', 'room_id', 'applicant_sex', 'app_status', 'payment_received',
'health_record_status', 'parent1_fname', 'parent1_lname', 'parent1_email',
'parent1_phone', 'applicant_shirt_size', 'referrals', 'preferred_roommate']
list_filter = ['app_year', 'program', 'group_id', 'room_id', 'applicant_sex', 'app_status',
'payment_received', 'health_record_status', 'applicant_shirt_size', 'referrals',
'preferred_roommate']

# should the time of app refer to the creation time or time last updated?
list_display =['applicant_fname', 'applicant_lname', 'applicant_bday', 'last_updated_at',
'program', 'group_id', 'room_id', 'applicant_sex', 'app_status', 'payment_received',
'health_record_status', 'parent1_fname', 'parent1_lname', 'parent1_email', 'parent1_phone',
'applicant_shirt_size', 'referrals', 'preferred_roommate']

# filter selector based on year
list_filter = ['app_year', 'program', 'group_id', 'room_id', 'applicant_sex', 'app_status', 'payment_received',
'health_record_status', 'applicant_shirt_size', 'referrals', 'preferred_roommate']
class HealthInfoAdmin(admin.ModelAdmin):
search_fields = ['applicant_fname', 'applicant_lname']

list_display = ['applicant_fname', 'applicant_lname', 'applicant_bday', 'created_at',
'program', 'applicant_sex', 'health_form_a_received', 'health_form_b_received']

# Register your models here.
# Register the base model, proxy model, and global data model
admin.site.register(Applicant, ApplicantAdmin)
admin.site.register(ApplicantHealth, HealthInfoAdmin)
admin.site.register(GlobalData, SingletonModelAdmin)

Loading

0 comments on commit e3430f4

Please sign in to comment.