Skip to content

Commit

Permalink
build: Very explicitly annotate a model field so that it passes mypy
Browse files Browse the repository at this point in the history
This clunky yet type-safe workaround to this django-stubs issue, which
arose when we upgraded django-stubs in the previous commits:
typeddjango/django-stubs#1802
  • Loading branch information
kdmccormick committed Jan 2, 2025
1 parent a5b773c commit 50944e9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions openedx/core/djangoapps/content/learning_sequences/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
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

Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 50944e9

Please sign in to comment.