Skip to content

Commit

Permalink
test: unpin django-stubs and update mypy (#6901)
Browse files Browse the repository at this point in the history
* chore: Unpin django-stubs / update mypy

* test: Use "app.model" for ManyToManyField

django-stubs requires "app.model" instead of just "model" for
ManyToManyField lazy model references.

See typeddjango/django-stubs#1802
  • Loading branch information
jennifer-richards authored Jan 10, 2024
1 parent 3312913 commit 81dc555
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion ietf/doc/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class State(models.Model):
desc = models.TextField(blank=True)
order = models.IntegerField(default=0)

next_states = models.ManyToManyField('State', related_name="previous_states", blank=True)
next_states = models.ManyToManyField('doc.State', related_name="previous_states", blank=True)

def __str__(self):
return self.name
Expand Down
4 changes: 2 additions & 2 deletions ietf/ipr/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
class IprDisclosureBase(models.Model):
by = ForeignKey(Person) # who was logged in, or System if nobody was logged in
compliant = models.BooleanField("Complies to RFC3979", default=True)
docs = models.ManyToManyField(Document, through='IprDocRel')
docs = models.ManyToManyField(Document, through='ipr.IprDocRel')
holder_legal_name = models.CharField(max_length=255)
notes = models.TextField("Additional notes", blank=True)
other_designations = models.CharField("Designations for other contributions", blank=True, max_length=255)
rel = models.ManyToManyField('self', through='RelatedIpr', symmetrical=False)
rel = models.ManyToManyField('self', through='ipr.RelatedIpr', symmetrical=False)
state = ForeignKey(IprDisclosureStateName)
submitter_name = models.CharField(max_length=255,blank=True)
submitter_email = models.EmailField(blank=True)
Expand Down
2 changes: 1 addition & 1 deletion ietf/liaisons/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class LiaisonStatement(models.Model):
body = models.TextField(blank=True)

tags = models.ManyToManyField(LiaisonStatementTagName, blank=True)
attachments = models.ManyToManyField(Document, through='LiaisonStatementAttachment', blank=True)
attachments = models.ManyToManyField(Document, through='liaisons.LiaisonStatementAttachment', blank=True)
state = ForeignKey(LiaisonStatementState, default='pending')

class Meta:
Expand Down
4 changes: 2 additions & 2 deletions ietf/mailtrigger/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def clean_duplicates(addrlist):
class MailTrigger(models.Model):
slug = models.CharField(max_length=64, primary_key=True)
desc = models.TextField(blank=True)
to = models.ManyToManyField('Recipient', blank=True, related_name='used_in_to')
cc = models.ManyToManyField('Recipient', blank=True, related_name='used_in_cc')
to = models.ManyToManyField('mailtrigger.Recipient', blank=True, related_name='used_in_to')
cc = models.ManyToManyField('mailtrigger.Recipient', blank=True, related_name='used_in_cc')

class Meta:
ordering = ["slug"]
Expand Down
2 changes: 1 addition & 1 deletion ietf/meeting/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ class TimeSlot(models.Model):
duration = models.DurationField(default=datetime.timedelta(0))
location = ForeignKey(Room, blank=True, null=True)
show_location = models.BooleanField(default=True, help_text="Show location in agenda.")
sessions = models.ManyToManyField('Session', related_name='slots', through='SchedTimeSessAssignment', blank=True, help_text="Scheduled session, if any.")
sessions = models.ManyToManyField('meeting.Session', related_name='slots', through='meeting.SchedTimeSessAssignment', blank=True, help_text="Scheduled session, if any.")
modified = models.DateTimeField(auto_now=True)
#

Expand Down
2 changes: 1 addition & 1 deletion ietf/name/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class DraftSubmissionStateName(NameModel):
"""Uploaded, Awaiting Submitter Authentication, Awaiting Approval from
Previous Version Authors, Awaiting Initial Version Approval, Awaiting
Manual Post, Cancelled, Posted"""
next_states = models.ManyToManyField('DraftSubmissionStateName', related_name="previous_states", blank=True)
next_states = models.ManyToManyField('name.DraftSubmissionStateName', related_name="previous_states", blank=True)
class RoomResourceName(NameModel):
"Room resources: Audio Stream, Meetecho, . . ."
class IprDisclosureStateName(NameModel):
Expand Down
8 changes: 4 additions & 4 deletions ietf/nomcom/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class Nominee(models.Model):

email = ForeignKey(Email)
person = ForeignKey(Person, blank=True, null=True)
nominee_position = models.ManyToManyField('Position', through='NomineePosition')
nominee_position = models.ManyToManyField('nomcom.Position', through='nomcom.NomineePosition')
duplicated = ForeignKey('Nominee', blank=True, null=True)
nomcom = ForeignKey('NomCom')

Expand Down Expand Up @@ -293,9 +293,9 @@ def get_description(self):
class Feedback(models.Model):
nomcom = ForeignKey('NomCom')
author = models.EmailField(verbose_name='Author', blank=True)
positions = models.ManyToManyField('Position', blank=True)
nominees = models.ManyToManyField('Nominee', blank=True)
topics = models.ManyToManyField('Topic', blank=True)
positions = models.ManyToManyField('nomcom.Position', blank=True)
nominees = models.ManyToManyField('nomcom.Nominee', blank=True)
topics = models.ManyToManyField('nomcom.Topic', blank=True)
subject = models.TextField(verbose_name='Subject', blank=True)
comments = models.BinaryField(verbose_name='Comments')
type = ForeignKey(FeedbackTypeName, blank=True, null=True)
Expand Down
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ django-markup>=1.5 # Limited use - need to reconcile against direct use of ma
django-oidc-provider>=0.8.1 # 0.8 dropped Django 2 support
django-referrer-policy>=1.0
django-simple-history>=3.0.0
#django-stubs>=4.2.0 # The django-stubs version used determines the the mypy version indicated below
django-stubs==4.2.4 # Pin here until we fix test failures (and update mypy version, too)
django-stubs>=4.2.7 # The django-stubs version used determines the the mypy version indicated below
django-tastypie>=0.14.5 # Version must be locked in sync with version of Django
django-vite>=2.0.2,<3
django-webtest>=1.9.10 # Only used in tests
Expand All @@ -46,7 +45,7 @@ markdown>=3.3.6
types-markdown>=3.3.6
mock>=4.0.3 # Used only by tests, of course
types-mock>=4.0.3
mypy~=1.2.0 # Version requirements determined by django-stubs.
mypy~=1.7.0 # Version requirements determined by django-stubs.
oic>=1.3 # Used only by tests
Pillow>=9.1.0
psycopg2>=2.9.6
Expand Down

0 comments on commit 81dc555

Please sign in to comment.