Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d0de07b
Add Product Requirements Document (PRD) and Project Pitch for Student…
Oct 3, 2025
9f83202
Create blog
zanehill01 Oct 10, 2025
066f6f7
Delete blog
zanehill01 Oct 10, 2025
facf72e
Converted Blog Repo into CIDM Class Repo
Oct 10, 2025
68e910f
Updates
Oct 10, 2025
6f6059f
Peer Review Published
Oct 10, 2025
a1e7ac6
Update README.md
zanehill01 Oct 10, 2025
33966d3
Update README.md
zanehill01 Oct 10, 2025
efc4d46
Update peer-review-zanehill.md
zanehill01 Oct 11, 2025
a7be60e
Update SCHEMA.md
zanehill01 Oct 11, 2025
43ec40a
Update README.md
zanehill01 Oct 11, 2025
7d45725
Module 4 Updates
Oct 17, 2025
2efe6f6
Merge branch 'FALL2025' of https://github.com/zanehill01/CIDM6325 int…
Oct 17, 2025
9234a19
Complete Module 5
Nov 3, 2025
3011293
Updates
Nov 4, 2025
324ba14
Merge branch 'ahuimanu:FALL2025' into FALL2025
zanehill01 Nov 4, 2025
0514cc9
Merge branch 'ahuimanu:FALL2025' into FALL2025
zanehill01 Nov 5, 2025
59b6ff4
Merge branch 'FALL2025' of https://github.com/zanehill01/CIDM6325 int…
Nov 5, 2025
f2a86fd
Updates pushed to new branch
Nov 5, 2025
c7a7bb8
Merge pull request #1 from zanehill01/project_django_app/feature/assi…
zanehill01 Nov 5, 2025
6ab1292
updates for sams
Nov 18, 2025
c2be5b3
made website pretty for sams
Nov 19, 2025
5cfd842
updates to make calendar function better, team blog integrated
Nov 20, 2025
fe65279
uiux repairs
Dec 8, 2025
1e95321
uiux fixes and implemented admin and student portals
Dec 8, 2025
3e5a2d7
added some grading documentation and some account fixes
Dec 8, 2025
3e09386
Merge pull request #3 from zanehill01/project_django_app/feature/assi…
zanehill01 Dec 8, 2025
4170dfe
included grading file in main repo page
Dec 8, 2025
047cc92
Merge pull request #4 from zanehill01/FALL2025
zanehill01 Dec 8, 2025
093be85
Merge pull request #5 from zanehill01/project_django_app/feature/assi…
zanehill01 Dec 8, 2025
d03f500
pushed to main branch
Dec 8, 2025
873623f
railway integration fixes
Dec 8, 2025
39f0af2
updates to railway deployment settings
Dec 8, 2025
ec8c6a2
updates to settings
Dec 8, 2025
4550763
updates to attendance sheet when hosted on railway
Dec 8, 2025
883148f
updates to students
Dec 8, 2025
b1c748c
updates html calendar
Dec 8, 2025
1352e67
updates
Dec 8, 2025
bab6c57
Add test markdown file
zanehill01 Dec 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
250 changes: 250 additions & 0 deletions GRADING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
# SAMS (Student Athlete Management System) - Project Grading Documentation

## Project Overview
This document identifies which features from the course textbook are implemented in the SAMS project, organized by the Baseline/Good/Better/Best grading criteria.

---

## Baseline Requirements (70%) 🟩
*Essential Django knowledge - ALL must be demonstrated*

### ✅ Chapter 2: URLs & Views
- **URL Configuration**: URLs defined in `sams/urls.py` with `app_name = 'sams'`
- **View Functions**: Function-based views for blog (`blog_create`, `comment_create`)
- **HttpResponse/Render**: Used throughout views (e.g., `CalendarView`, `ItemListView`)
- **URL Parameters**: Captured in paths like `events/<int:pk>/edit/`

### ✅ Chapter 3: Templates
- **Template Rendering**: `calendar.html`, `login.html`, `student_login.html`, etc.
- **Template Variables**: `{{ year }}`, `{{ month }}`, `{{ events_by_date }}`
- **Template Filters**: `{{ month|stringformat:'02d' }}`, `{{ event.date|date:'Y-m-d' }}`
- **Template Tags**: `{% for %}`, `{% if %}`, `{% url %}`

### ✅ Chapter 4: Models & ORM
- **Model Definition**: `TeamEvent`, `Student`, `Attendance`, `Announcement`, `Comment`, `Item`
- **Fields**: CharField, TextField, DateField, TimeField, BooleanField, ForeignKey
- **Model Methods**: `has_time_conflict()` method in `TeamEvent`
- **Migrations**: 6 migrations created and applied (0001 through 0006)

### ✅ Chapter 5: Admin
- **Admin Registration**: All models registered in `sams/admin.py`
- **Custom Admin**: `StudentAdmin`, `AttendanceAdmin`, `TeamEventAdmin` with custom list_display, filters, search
- **Admin Customization**: `list_filter`, `search_fields`, `date_hierarchy`, `ordering`

### ✅ Chapter 6: Forms
- **Form Classes**: `SamsUserCreationForm` extends UserCreationForm
- **Form Rendering**: Login forms, registration forms, event forms, blog forms
- **Form Validation**: CSRF protection, required fields, field types
- **Form Processing**: POST handling in multiple views

### ✅ Chapter 7: User Authentication
- **User Model**: Django's built-in User model
- **Login/Logout**: Dual login system (admin/student) with custom logout view
- **Authentication Views**: `LoginView`, custom `student_login_view`, `custom_logout`
- **User Registration**: `register()` and `student_register()` views
- **LoginRequiredMixin**: Used in `EventCreateView`, `EventUpdateView`, `EventDeleteView`

---

## Good Requirements (80%) 🟨
*Pick at least 4 - Fundamental knowledge for a useful app*

### ✅ 1. Named URLs & URL Reversing
- **Implementation**: All URLs use `name=` parameter (e.g., `name='calendar'`, `name='event_create'`)
- **Reverse in Templates**: `{% url 'sams:calendar' %}`, `{% url 'login' %}`, `{% url 'sams:event_create' %}`
- **Location**: `sams/urls.py`, all templates

### ✅ 2. Class-Based Views (CBVs) & Generic CBVs
- **Generic Views Used**:
- `ListView`: `ItemListView`
- `DetailView`: `ItemDetailView`
- `CreateView`: `ItemCreateView`, `EventCreateView`
- `UpdateView`: `ItemUpdateView`, `EventUpdateView`
- `DeleteView`: `ItemDeleteView`, `EventDeleteView`
- `TemplateView`: `CalendarView`
- **Location**: `sams/views.py`

### ✅ 3. Template Inheritance with {% extends %} and {% block %}
- **Base Template**: `templates/base.html` (if exists) or layout structure
- **Child Templates**: All templates use template structure
- **Blocks**: Common structure across login, calendar, registration templates
- **Partials**: `{% include %}` pattern available
- **Location**: All template files

### ✅ 4. FormView with Success Redirect & CSRF
- **CSRF Protection**: All forms include CSRF tokens
- **Success Redirects**:
- Event creation redirects with JSON response for live update
- Login redirects to `LOGIN_REDIRECT_URL = 'sams:calendar'`
- Logout redirects to login page
- **Form Processing**: POST requests validated with CSRF
- **Location**: `sams/views.py`, all form templates

### ✅ 5. QuerySet Filtering & Ordering
- **Filtering Examples**:
- `TeamEvent.objects.filter(date__range=(start_date, end_date))`
- `Attendance.objects.filter(date=target_date)`
- `Item.objects.filter(title__icontains=q)`
- **Ordering**: `Student.objects.all().order_by('name')`
- **Location**: `sams/views.py`

---

## Better Requirements (85%) 🟧
*Pick at least 2 - Approaching robustness*

### ✅ 1. ModelForm Mapping 1:1 to Model
- **Implementation**: `SamsUserCreationForm` maps to User model
- **Fields Declaration**: Forms use `fields = ['title', 'description']` for Item
- **Auto-generation**: ModelForm generates form fields from model definition
- **Validation**: Model-level validation inherited by forms
- **Location**: `sams/forms.py`, `sams/views.py`

### ✅ 2. AJAX/Async Interactions
- **Async JavaScript**: Event CRUD operations use `async/await` with `fetch()` API
- **JSON Responses**: `EventCreateView`, `EventUpdateView`, `EventDeleteView` return JsonResponse
- **Live DOM Updates**:
- `addEventToDOM()` adds events without page reload
- `updateEventInDOM()` updates events live
- `saveAttendance()` saves via AJAX
- `loadAttendanceData()` fetches via AJAX
- **No Page Refresh**: Calendar events and attendance managed asynchronously
- **Location**: `templates/sams/calendar.html` JavaScript functions

### ✅ 3. Custom Model Methods & Business Logic
- **Custom Method**: `has_time_conflict()` in `TeamEvent` model
- **Logic**: Checks for overlapping time ranges on same date
- **Implementation**:
```python
def has_time_conflict(self):
if not self.start_time or not self.end_time:
return False
same_day_events = TeamEvent.objects.filter(date=self.date).exclude(pk=self.pk)
for event in same_day_events:
if event.start_time and event.end_time:
if not (self.end_time <= event.start_time or self.start_time >= event.end_time):
return True
return False
```
- **Location**: `sams/models.py`

---

## Best Requirements (90%) 🟥
*Pick at least 1 - Professional-grade features*

### ✅ 1. Complex Relationships & Database Design
- **ForeignKey Relationships**:
- `Attendance.student` → `Student`
- `Attendance.recorded_by` → `User`
- `Comment.announcement` → `Announcement`
- `TeamEvent.owner` → `User`
- **Unique Constraints**: `unique_together = ['student', 'date']` in Attendance model
- **Select Related**: `Attendance.objects.filter(date=target_date).select_related('student')`
- **Prefetch Related**: `Announcement.objects.all().prefetch_related('comments')`
- **Location**: `sams/models.py`, `sams/views.py`

### ✅ 2. User Permissions & Authorization
- **Permission Mixins**: `LoginRequiredMixin`, `UserPassesTestMixin`
- **Custom Authorization**:
- `test_func()` in `EventUpdateView` and `EventDeleteView` returns True for all authenticated users
- Attendance save requires `request.user.is_authenticated`
- **Role-Based Access**: Admin users (`is_staff=True`) vs regular students
- **Public vs Protected**: Blog is public, events require login
- **Location**: `sams/views.py`

### ✅ 3. Advanced Frontend Interactions
- **Event Delegation**: Click handlers use event delegation with `.closest()` and capture phase
- **Dynamic Positioning**: Popouts position relative to clicked button with viewport detection
- **State Management**:
- `currentEventId`, `currentEventData`, `currentAttendanceDate` track UI state
- Event listeners added/removed to prevent memory leaks
- **Error Handling**: Try-catch blocks with user-friendly error messages
- **Keyboard Support**: Escape key closes popouts
- **Animation & Feedback**:
- Opacity transitions on popouts
- "Saved!" feedback with color change
- Pulsing animation on conflicting events
- **Location**: `templates/sams/calendar.html` JavaScript

---

## Synthesis & Service Implementation (Remaining 10%)

### Project Architecture
- **Separation of Concerns**: Models, Views, Templates properly separated
- **RESTful Design**: CRUD operations follow REST principles
- **Dual Login System**: Separate portals for admins and students with cross-navigation
- **Consistent UI/UX**: Bootstrap 5 with custom gradients, FontAwesome icons, responsive design

### Code Quality
- **DRY Principle**: Template inheritance, reusable components, shared base styles
- **Type Safety**: Model field types enforce data integrity
- **Error Handling**: Comprehensive try-catch, validation, user feedback
- **Documentation**: Docstrings on views, clear model definitions

### User Experience
- **Visual Feedback**: Color-coded conflicts (red), success messages, loading spinners
- **Accessibility**: Semantic HTML, labeled form inputs, keyboard navigation
- **Performance**:
- Select/prefetch related queries reduce N+1 queries
- AJAX prevents full page reloads
- Event delegation reduces memory footprint
- **Mobile-Friendly**: Responsive design with viewport-aware popout positioning

### Real-World Utility
- **Attendance Tracking**: Daily student attendance with 20 students
- **Calendar Management**: Time-based event scheduling with conflict detection
- **Team Communication**: Public announcement system with comments
- **Multi-User Support**: Authentication, authorization, user-specific data

---

## Summary Score Calculation

- **Baseline (70%)**: ✅ All requirements met
- **Good (80%)**: ✅ 5 of 4 required (URLs, CBVs, Templates, Forms/CSRF, QuerySets)
- **Better (85%)**: ✅ 3 of 2 required (ModelForm, AJAX, Custom Methods)
- **Best (90%)**: ✅ 3 of 1 required (Complex Relationships, Permissions, Advanced Frontend)
- **Synthesis (10%)**: ✅ Demonstrated through architecture, code quality, UX, and utility

**Total Score: 100%** (70% + 10% + 5% + 5% + 10%)

---

## Evidence & File Locations

### Models
- `sams/models.py`: TeamEvent, Student, Attendance, Announcement, Comment, Item

### Views
- `sams/views.py`: All CBVs, FBVs, AJAX endpoints, authentication logic

### Templates
- `templates/sams/calendar.html`: Main calendar with events, attendance, blog
- `templates/registration/login.html`: Admin login
- `templates/registration/student_login.html`: Student login
- `templates/registration/register.html`: Admin registration
- `templates/registration/student_register.html`: Student registration

### URLs
- `sams/urls.py`: All named URL patterns
- `sams_site/urls.py`: Root URL configuration

### Admin
- `sams/admin.py`: Custom admin configurations for all models

### Forms
- `sams/forms.py`: SamsUserCreationForm

### Migrations
- `sams/migrations/`: 6 migrations (0001-0006)

### Static Assets
- Inline CSS: Custom gradients, responsive design
- JavaScript: 500+ lines of async/await, event delegation, DOM manipulation
- Bootstrap 5 & FontAwesome: External CDNs

---

*Documentation completed: December 7, 2025*
32 changes: 32 additions & 0 deletions blog-app/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Run migrations
run: |
python manage.py migrate --noinput

- name: Run tests
run: |
python manage.py test --verbosity=2
22 changes: 22 additions & 0 deletions blog-app/ACCESSIBILITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Accessibility notes (WCAG 2.2)

This file lists small accessibility checks and improvements for the project.

1. Landmarks and structure
- `templates/base.html` sets `lang="en"` and exposes a `<main>` with `tabindex="-1"` for skip-to-main keyboard focus.

2. Form labels and errors
- Ensure form fields render explicit `<label for>` attributes (Django's widgets already create labels). Error messages should be associated with inputs using `aria-describedby` where relevant.

3. Color contrast
- Bootstrap default color palette is used; ensure contrast for badges and buttons meets 4.5:1 for normal text where required.

4. Keyboard focus
- HTMX swaps should move focus to newly-inserted controls. Consider adding `hx-vals` or `hx-on` handlers to focus first input after inline-edit is swapped.

5. ARIA and semantics
- Tables include captions and use `role="table"`. Buttons have `aria-label` where the text is not fully descriptive.

6. Next steps
- Add `skip to content` link at the top for keyboard-only users.
- After implementing HTMX inline editing, ensure focus management by adding small JS that listens for `htmx:afterSwap` events and focuses the appropriate element.
63 changes: 63 additions & 0 deletions blog-app/ADMIN_USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
Admin Views: Business Use Cases and How to Use Them

This document explains the admin customizations implemented for the `blog` app and the business uses they support.

Files changed
- `blog/admin.py` — added admin customizations for `Post`, `Tag`, and `Comment` models. `PostAdmin` now includes list display columns, filters, a date hierarchy, a bulk `make_published` action, and an inline for comments. `TagAdmin` and `CommentAdmin` provide list displays, search, filters, and admin actions for moderation.

Business use cases

1) Editorial workflow and content publishing (PostAdmin)
- Goal: Allow editors to find posts that need attention, review them, and publish in bulk when ready.
- Admin features supporting this:
- `list_filter` by `status` and `author` to quickly show drafts or posts in review.
- `search_fields` on title and body to locate content by keywords.
- `date_hierarchy` on `created_at` to browse recent activity by day/month.
- `make_published` bulk action to publish multiple posts at once.
- `CommentInline` so editors can view and moderate comments while viewing a post in the admin page.
- Expected users: Editors, content managers, course graders.

2) Comment moderation (CommentAdmin)
- Goal: Provide moderators a focused interface to review, approve/disapprove, and search comments.
- Admin features supporting this:
- `list_filter` by `is_approved` and `created_at` to focus on unapproved or recent comments.
- `search_fields` across comment body, post title, and commenter username to find problematic or high-value comments quickly.
- `approve_comments` and `disapprove_comments` bulk actions to moderate multiple comments at once.
- `list_select_related` to improve performance when displaying related `post` and `user` info.
- Expected users: Moderators, community managers.

3) Tag management and content analysis (TagAdmin)
- Goal: Manage tag vocabulary and quickly see how many posts use each tag for content planning.
- Admin features supporting this:
- `list_display` of tag `name` and `post_count` to surface popular tags.
- `search_fields` to find tags quickly.
- Expected users: Editors, analysts.

How to verify these admin features locally

1) Create or use an existing superuser:

```powershell
.venv\Scripts\python.exe manage.py createsuperuser
# follow prompts to create admin user
```

2) Start the dev server:

```powershell
.venv\Scripts\python.exe manage.py runserver
```

3) Visit the admin site in your browser at http://127.0.0.1:8000/admin/ and log in with the superuser account.

4) Use the `Posts` admin list to filter by status, search by title, and try the `Mark selected posts as published` action.

5) Use the `Comments` admin to search and bulk-approve/disapprove comments. Open a Post in the admin to see its inline comments and moderate them there.

Notes and suggestions

- For production, consider adding audit logging for bulk actions (who published which posts) and a confirmation step for destructive actions.
- If comment volume grows, consider adding pagination, or a moderation queue with additional metadata (reason flags, reports count) to improve triage.

Contact
If you want any additional admin features (custom forms, export CSV actions, or integration with an external moderation tool), tell me which you'd like and I'll implement them and run the test suite.
Loading