Skip to content

draft mode + homework form consolidation#28

Open
PavanVemparala wants to merge 4 commits intomainfrom
draftmode
Open

draft mode + homework form consolidation#28
PavanVemparala wants to merge 4 commits intomainfrom
draftmode

Conversation

@PavanVemparala
Copy link
Copy Markdown
Collaborator

Draft mode for homework assignments — teachers can now save incomplete homeworks as drafts and publish when
ready, with full scheduling and expiry support.

Core changes

Model (homeworks/models.py)

  • due_date made nullable — drafts no longer require a due date
  • Added homework_type (draft/published/hidden) as a display label
  • Added publish_at — datetime at which a draft auto-publishes
  • is_hidden remains the single source of truth for student access (never homework_type)
  • New properties: is_draft, should_auto_publish; is_overdue guarded against None due_date

Publishing flow (homeworks/forms.py, views)

  • Removed is_hidden from both forms — it is now managed automatically by the server
  • Added "Publish now" toggle (checked by default): when on, publishes immediately; when off, publish_at is
    required and must be future
  • Save as Draft bypasses all validation — only title/description written directly to ORM
  • Scheduled publish: saving with publish_now unchecked keeps homework as DRAFT with publish_at set;
    auto_publish_due_drafts() runs lazily on each page load to promote these
  • Re-publishing an expired homework automatically clears a stale expires_at

Section UX (homeworks/templates/homeworks/form.html)

  • order field replaced with up/down arrow buttons — order managed automatically by JS
  • "Add Another Section" now clones from a permanent hidden template, fixing a crash when the section container
    is empty (e.g. editing a draft with no sections yet)

Course detail (courses/views.py, courses/templates/courses/detail.html)

  • Homework list shows draft/hidden/expired/scheduled badges matching the homeworks list view
  • Duplicate HomeworkFormData dataclass removed — CourseHomeworkCreateView now shares the same form template and dataclass as HomeworkEditView

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant