Port iesg.feeds
- Legacy-Id: 3126
This commit is contained in:
parent
f22e864d62
commit
6a927fbed4
|
@ -1,5 +1,6 @@
|
|||
# Copyright The IETF Trust 2007, 2008, All Rights Reserved
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.syndication.feeds import Feed
|
||||
from django.utils.feedgenerator import Atom1Feed
|
||||
from ietf.idtracker.models import IDInternal
|
||||
|
@ -11,12 +12,24 @@ class IESGAgenda(Feed):
|
|||
feed_type = Atom1Feed
|
||||
|
||||
def items(self):
|
||||
return IDInternal.objects.filter(agenda=1).order_by('telechat_date')
|
||||
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
|
||||
from doc.models import TelechatEvent
|
||||
drafts = IDInternal.objects.filter(event__telechatevent__telechat_date__gte=datetime.date.min).distinct()
|
||||
for d in drafts:
|
||||
d.latest_telechat_event = d.latest_event(TelechatEvent, type="scheduled_for_telechat")
|
||||
drafts = [d for d in drafts if d.latest_telechat_event.telechat_date]
|
||||
drafts.sort(key=lambda d: d.latest_telechat_event.telechat_date)
|
||||
return drafts
|
||||
|
||||
return IDInternal.objects.filter(agenda=1).order_by('telechat_date')
|
||||
|
||||
def item_categories(self, item):
|
||||
return [ str(item.telechat_date) ]
|
||||
|
||||
def item_pubdate(self, item):
|
||||
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
|
||||
return item.latest_telechat_event.time
|
||||
|
||||
f = item.comments().filter(comment_text__startswith='Placed on agenda for telechat')
|
||||
try:
|
||||
comment = f[0]
|
||||
|
@ -28,4 +41,7 @@ class IESGAgenda(Feed):
|
|||
def item_author_name(self, item):
|
||||
return str( item.job_owner )
|
||||
def item_author_email(self, item):
|
||||
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
|
||||
return item.ad.address
|
||||
|
||||
return item.job_owner.person.email()[1]
|
||||
|
|
|
@ -344,13 +344,13 @@ class InternetDraft(Document):
|
|||
def mark_by(self):
|
||||
e = self.latest_event()
|
||||
from person.proxy import IESGLogin as IESGLoginProxy
|
||||
return IESGLoginProxy(e.by) if e else None
|
||||
return IESGLoginProxy().from_object(e.by) if e else None
|
||||
|
||||
# job_owner = models.ForeignKey(IESGLogin, db_column='job_owner', related_name='documents')
|
||||
@property
|
||||
def job_owner(self):
|
||||
from person.proxy import IESGLogin as IESGLoginProxy
|
||||
return IESGLoginProxy(self.ad) if self.ad else None
|
||||
return IESGLoginProxy().from_object(self.ad) if self.ad else None
|
||||
|
||||
#event_date = models.DateField(null=True)
|
||||
@property
|
||||
|
@ -441,7 +441,7 @@ class InternetDraft(Document):
|
|||
def resurrect_requested_by(self):
|
||||
e = self.latest_event(type__in=("requested_resurrect", "completed_resurrect"))
|
||||
from person.proxy import IESGLogin as IESGLoginProxy
|
||||
return IESGLoginProxy(e.by) if e and e.type == "requested_resurrect" else None
|
||||
return IESGLoginProxy().from_object(e.by) if e and e.type == "requested_resurrect" else None
|
||||
|
||||
#approved_in_minute = models.IntegerField(null=True, blank=True)
|
||||
@property
|
||||
|
@ -450,7 +450,7 @@ class InternetDraft(Document):
|
|||
|
||||
|
||||
def get_absolute_url(self):
|
||||
if self.rfc_flag:
|
||||
if self.rfc_flag and self.rfc_number:
|
||||
return "/doc/rfc%d/" % self.rfc_number
|
||||
else:
|
||||
return "/doc/%s/" % self.name
|
||||
|
@ -502,7 +502,7 @@ class InternetDraft(Document):
|
|||
def an_sent_by(self):
|
||||
e = self.latest_event(type="iesg_approved")
|
||||
from person.proxy import IESGLogin as IESGLoginProxy
|
||||
return IESGLoginProxy(e.by) if e else None
|
||||
return IESGLoginProxy().from_object(e.by) if e else None
|
||||
|
||||
#defer = models.BooleanField()
|
||||
@property
|
||||
|
@ -515,7 +515,7 @@ class InternetDraft(Document):
|
|||
def defer_by(self):
|
||||
e = self.latest_event(type="changed_document", desc__startswith="State changed to <b>IESG Evaluation - Defer</b>")
|
||||
from person.proxy import IESGLogin as IESGLoginProxy
|
||||
return IESGLoginProxy(e.by) if e else None
|
||||
return IESGLoginProxy().from_object(e.by) if e else None
|
||||
|
||||
#defer_date = models.DateField(null=True, blank=True)
|
||||
@property
|
||||
|
@ -556,7 +556,7 @@ class InternetDraft(Document):
|
|||
res = []
|
||||
def add(ad, pos):
|
||||
from person.proxy import IESGLogin as IESGLoginProxy
|
||||
res.append(dict(ad=IESGLoginProxy(ad), pos=Position().from_object(pos) if pos else None))
|
||||
res.append(dict(ad=IESGLoginProxy().from_object(ad), pos=Position().from_object(pos) if pos else None))
|
||||
|
||||
found = set()
|
||||
for pos in BallotPositionEvent.objects.filter(doc=self, type="changed_ballot_position", ad__in=active_ads).select_related('ad').order_by("-time", "-id"):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from models import *
|
||||
|
||||
class IESGLogin(Email):
|
||||
def __init__(self, base):
|
||||
def from_object(self, base):
|
||||
for f in base._meta.fields:
|
||||
setattr(self, f.name, getattr(base, f.name))
|
||||
|
||||
|
|
Loading…
Reference in a new issue