fix: use the intended state machine in person doc searches (#5204)
* fix: use the intended state machine in person doc searches * chore: apply black to two touched functions
This commit is contained in:
parent
91be593c82
commit
cbe534ee06
|
@ -187,12 +187,31 @@ class Person(models.Model):
|
||||||
|
|
||||||
def active_drafts(self):
|
def active_drafts(self):
|
||||||
from ietf.doc.models import Document
|
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):
|
def expired_drafts(self):
|
||||||
from ietf.doc.models import Document
|
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):
|
def save(self, *args, **kwargs):
|
||||||
created = not self.pk
|
created = not self.pk
|
||||||
|
|
Loading…
Reference in a new issue