using pretty much the same template as for a non-form view. This solution is less hackish than the previous one which used the form.as_table() rendering of a form, and then split the resulting html in chunks. Instead, '''all''' the html has been moved out to a formfield template, and a custom form class is generated which will render the form elements using an indicated template. * Add form factory in utils.py (an old version which still has html in the code is there for history, but will be removed * Changes in ipr/views.py:new(), now subclassing one form with some class members being other form instances, matching the members used for the show() view * A fix in ipr/models, making an email field use models.EmailField * Reverting a number of changes in ipr/details.html which aren't needed any more, as well as in ipr/new.html; and adding ipr/formfield.html - Legacy-Id: 104
26 lines
821 B
Python
26 lines
821 B
Python
from django.contrib.syndication.feeds import Feed
|
|
from django.utils.feedgenerator import Atom1Feed
|
|
from ietf.ipr.models import IprDetail
|
|
import datetime
|
|
|
|
class LatestIprDisclosures(Feed):
|
|
feed_type = Atom1Feed
|
|
title = "IPR Disclosures to the IETF"
|
|
link = "/ipr/"
|
|
description = "Updates on new IPR Disclosures made to the IETF."
|
|
language = "en"
|
|
feed_url = "/feeds/ipr/"
|
|
|
|
def items(self):
|
|
return IprDetail.objects.order_by('-submitted_date')[:5]
|
|
|
|
def item_link(self, item):
|
|
return "/ipr/ipr-%s" % item.ipr_id
|
|
def item_pubdate(self, item):
|
|
return item.submitted_date
|
|
def item_author_name(self, item):
|
|
return item.get_submitter().name or None
|
|
def item_author_email(self, item):
|
|
return item.get_submitter().email or None
|
|
|
|
|