Made sure Person.active_drafts() and .expired_drafts() don't return duplicate entries. Fixes issue #2784.

- Legacy-Id: 16665
This commit is contained in:
Henrik Levkowetz 2019-08-20 22:43:51 +00:00
parent 50d2160afe
commit dc6201eeeb

View file

@ -168,11 +168,11 @@ class Person(models.Model):
def active_drafts(self):
from ietf.doc.models import Document
return Document.objects.filter(documentauthor__person=self, type='draft', states__slug='active').order_by('-time')
return Document.objects.filter(documentauthor__person=self, 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']).order_by('-time')
return Document.objects.filter(documentauthor__person=self, type='draft', states__slug__in=['repl', 'expired', 'auth-rm', 'ietf-rm']).distinct().order_by('-time')
def needs_consent(self):
"""