Skip to content

Commit

Permalink
mypy: Don't use lazy ManyToManyField with implicit app label
Browse files Browse the repository at this point in the history
Per
typeddjango/django-stubs#1802 (comment),
`ManyToManyField`s with lazy (string) models but no app label don't
work. In this case, we can just use the class directly, not the string,
so do that.
  • Loading branch information
dehnert committed Jul 8, 2024
1 parent 58f3f86 commit 446377d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions squaresdb/membership/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ class TSClass(models.Model):
label = models.CharField(max_length=20)
coordinator = models.ForeignKey(Person, on_delete=models.PROTECT,
related_name='class_coord')
assistants = models.ManyToManyField('Person', through='TSClassAssist',
assistants = models.ManyToManyField(Person, through='TSClassAssist',
related_name='class_assist')
students = models.ManyToManyField('Person', through='TSClassMember',
students = models.ManyToManyField(Person, through='TSClassMember',
related_name='classes')
start_date = models.DateField(null=True, blank=True)
end_date = models.DateField(null=True, blank=True)
Expand Down

0 comments on commit 446377d

Please sign in to comment.