Skip to content

Commit

Permalink
Fixes #1135 - Add a date field to the courses table to capture when t…
Browse files Browse the repository at this point in the history
…he course was added to MyLA (#1535)
  • Loading branch information
jonespm authored Sep 12, 2023
1 parent ff3bddb commit 9cb87ad
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dashboard/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ def has_add_permission(self, request):
class CourseAdmin(admin.ModelAdmin):
inlines = [CourseViewOptionInline, ]
form = CourseForm
fields = ('canvas_id', 'name', 'term', 'date_start', 'date_end', 'show_grade_counts', 'show_grade_type', 'data_last_updated')
list_display = ('canvas_id', 'name', 'term', 'show_grade_counts', 'course_link', '_courseviewoption', 'data_last_updated')
fields = ('canvas_id', 'name', 'term', 'date_start', 'date_end', 'show_grade_counts', 'show_grade_type', 'data_last_updated', 'date_created')
list_display = ('canvas_id', 'name', 'term', 'show_grade_counts', 'course_link', '_courseviewoption', 'data_last_updated', 'date_created')
list_select_related = True
readonly_fields = ('term', 'data_last_updated',)
readonly_fields = ('term', 'data_last_updated', 'date_created')
actions = ['clear_course_updated_dates']

def view_on_site(self, obj):
Expand Down
25 changes: 25 additions & 0 deletions dashboard/migrations/0026_course_date_created.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 3.2.20 on 2023-09-06 18:48

import datetime
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('dashboard', '0025_remove_courseviewoption_show_assignment_planning_v1'),
]

# Initially set this to null but alter it to default to the current date
operations = [
migrations.AddField(
model_name='course',
name='date_created',
field=models.DateTimeField(default=None, null=True, blank=True, verbose_name='Date course was created'),
),
migrations.AlterField(
model_name='course',
name='date_created',
field=models.DateTimeField(blank=True, default=datetime.datetime.now, null=True, verbose_name='Date course was created'),
),
]
1 change: 1 addition & 0 deletions dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ class Course(models.Model):
show_grade_type = models.CharField(verbose_name="Show Grade Type", max_length=255,
choices=GRADING_CHOICES, default='Percent')
data_last_updated = models.DateTimeField(verbose_name="Data last updated", null=True, blank=True)
date_created = models.DateTimeField(verbose_name="Date course was created", default=datetime.now, null=True, blank=True)

objects = CourseQuerySet().as_manager()

Expand Down

0 comments on commit 9cb87ad

Please sign in to comment.