build: Very explicitly annotate a model field so that it passes mypy

This clunky yet type-safe workaround to this django-stubs issue, which
arose when we upgraded django-stubs in the previous commits:
https://github.com/typeddjango/django-stubs/issues/1802
This commit is contained in:
Kyle D. McCormick
2025-01-02 10:57:08 -05:00
committed by Kyle McCormick
parent a5b773ce7b
commit 50944e9d75

View File

@@ -37,6 +37,8 @@ that separated.
yourself to the LearningContext and LearningSequence models. Other tables are
not guaranteed to stick around, and values may be deleted unexpectedly.
"""
from __future__ import annotations
from django.db import models
from model_utils.models import TimeStampedModel
@@ -214,7 +216,7 @@ class CourseSection(CourseContentVisibilityMixin, TimeStampedModel):
# What is our position within the Course? (starts with 0)
ordering = models.PositiveIntegerField(null=False)
new_user_partition_groups = models.ManyToManyField(
new_user_partition_groups: models.ManyToManyField[UserPartitionGroup, models.Model] = models.ManyToManyField(
UserPartitionGroup,
db_index=True,
related_name='sec_user_partition_groups',
@@ -280,7 +282,7 @@ class CourseSectionSequence(CourseContentVisibilityMixin, TimeStampedModel):
# sequences across 20 sections, the numbering here would be 0-199.
ordering = models.PositiveIntegerField(null=False)
new_user_partition_groups = models.ManyToManyField(
new_user_partition_groups: models.ManyToManyField[UserPartitionGroup, models.Model] = models.ManyToManyField(
UserPartitionGroup,
db_index=True,
related_name='secseq_user_partition_groups',