Skip to content

Commit

Permalink
Add last_accessed_date field (tl-its-umich-edu#1610)
Browse files Browse the repository at this point in the history
* changed function call logger.info to logger.debug

* model changed, migration file added, may be missing a migration file? since I think it should be 0029 not 0028

* updated migrations to match master

* removing deleted file

* added last_accessed_date field to admin.py
  • Loading branch information
jxiao21 authored Aug 26, 2024
1 parent f7052b5 commit 5f5bc39
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
6 changes: 3 additions & 3 deletions dashboard/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,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', 'date_created')
list_display = ('canvas_id', 'name', 'term', 'show_grade_counts', 'course_link', '_courseviewoption', 'data_last_updated', 'date_created')
fields = ('canvas_id', 'name', 'term', 'date_start', 'date_end', 'show_grade_counts', 'show_grade_type', 'data_last_updated', 'date_created', 'last_accessed_date')
list_display = ('canvas_id', 'name', 'term', 'show_grade_counts', 'course_link', '_courseviewoption', 'data_last_updated', 'date_created', 'last_accessed_date')
list_select_related = True
readonly_fields = ('term', 'data_last_updated', 'date_created')
readonly_fields = ('term', 'data_last_updated', 'date_created', 'last_accessed_date')
actions = ['clear_course_updated_dates']

def view_on_site(self, obj):
Expand Down
18 changes: 18 additions & 0 deletions dashboard/migrations/0030_course_last_accessed_date.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.14 on 2024-08-16 15:55

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('dashboard', '0029_resourceaccess_user_id_idx'),
]

operations = [
migrations.AddField(
model_name='course',
name='last_accessed_date',
field=models.DateTimeField(blank=True, help_text='The last time this course was accessed', null=True),
),
]
2 changes: 1 addition & 1 deletion dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class Course(models.Model):
choices=GRADING_CHOICES, default='Percent')
data_last_updated = models.DateTimeField(null=True, blank=True, help_text="This is the last time the cron was run and can be reset on the main courses page with the dropdown")
date_created = models.DateTimeField(verbose_name="Date course was created", default=datetime.now, null=True, blank=True)

last_accessed_date = models.DateTimeField(blank=True, null=True, help_text='The last time this course was accessed')
objects = CourseQuerySet().as_manager()

def __str__(self):
Expand Down

0 comments on commit 5f5bc39

Please sign in to comment.