Spaces:
Sleeping
Sleeping
Download backend/api/admin.py from CineDev/respirex-backend: direct link, hf CLI and curl.
- Browser
- Download file 906 Bytes
-
https://huggingface.co/spaces/CineDev/respirex-backend/resolve/main/backend/api/admin.py
- Command line
-
hf download hf://spaces/CineDev/respirex-backend/backend/api/admin.py
-
curl -L -o admin.py https://huggingface.co/spaces/CineDev/respirex-backend/resolve/main/backend/api/admin.py
906 Bytes
| from django.contrib import admin | |
| from .models import UserProfile, TestResult | |
| # Register the UserProfile model so you can change roles | |
| class UserProfileAdmin(admin.ModelAdmin): | |
| # Columns to show in the list | |
| list_display = ('user', 'email_display', 'role', 'full_name', 'phone') | |
| # Filters on the right sidebar | |
| list_filter = ('role', 'state') | |
| # Search box functionality | |
| search_fields = ('user__username', 'user__email', 'full_name') | |
| # Helper to show email from the related User model | |
| def email_display(self, obj): | |
| return obj.user.email | |
| email_display.short_description = 'Email' | |
| # Register the TestResult model to see patient scans | |
| class TestResultAdmin(admin.ModelAdmin): | |
| list_display = ('patient', 'result', 'confidence_score', 'date_tested') | |
| list_filter = ('result', 'risk_level', 'date_tested') |