Skip to content

Commit

Permalink
fix: use the intended state machine in person doc searches (#5204)
Browse files Browse the repository at this point in the history
* fix: use the intended state machine in  person doc searches

* chore: apply black to two touched functions
  • Loading branch information
rjsparks authored Feb 24, 2023
1 parent 91be593 commit cbe534e
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions ietf/person/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,31 @@ def rfcs(self):

def active_drafts(self):
from ietf.doc.models import Document
return Document.objects.filter(documentauthor__person=self, type='draft', states__slug='active').distinct().order_by('-time')

return (
Document.objects.filter(
documentauthor__person=self,
type="draft",
states__type="draft",
states__slug="active",
)
.distinct()
.order_by("-time")
)

def expired_drafts(self):
from ietf.doc.models import Document
return Document.objects.filter(documentauthor__person=self, type='draft', states__slug__in=['repl', 'expired', 'auth-rm', 'ietf-rm']).distinct().order_by('-time')

return (
Document.objects.filter(
documentauthor__person=self,
type="draft",
states__type="draft",
states__slug__in=["repl", "expired", "auth-rm", "ietf-rm"],
)
.distinct()
.order_by("-time")
)

def save(self, *args, **kwargs):
created = not self.pk
Expand Down

0 comments on commit cbe534e

Please sign in to comment.