mango r249 - in branches/django: . mango
- From: ovitters svn gnome org
- To: svn-commits-list gnome org,gnome-sysadmin gnome org
- Subject: mango r249 - in branches/django: . mango
- Date: Tue, 24 Jun 2008 20:24:43 +0000 (UTC)
Author: ovitters
Date: Tue Jun 24 20:24:43 2008
New Revision: 249
URL: http://svn.gnome.org/viewvc/mango?rev=249&view=rev
Log:
* mango/models.py (Foundationmembers): Add is_member and need_to_renew
properties.
* mango/views.py (list_foundationmembers): Add missing information to
the XML.
Modified:
branches/django/ (props changed)
branches/django/ChangeLog
branches/django/mango/models.py
branches/django/mango/views.py
Modified: branches/django/mango/models.py
==============================================================================
--- branches/django/mango/models.py (original)
+++ branches/django/mango/models.py Tue Jun 24 20:24:43 2008
@@ -16,6 +16,8 @@
import ldap
import ldap.filter
+import datetime
+
class AccountRequest(models.Model):
id = models.AutoField(primary_key=True)
uid = models.CharField(max_length=15)
@@ -57,6 +59,16 @@
last_renewed_on = models.DateField(null=True, blank=True)
last_update = models.DateTimeField()
resigned_on = models.DateField(null=True, blank=True)
+
+ @property
+ def is_member(self):
+ return (self.resigned_on is None)
+
+ @property
+ def need_to_renew(self):
+ diff = datetime.date.today() - self.last_renewed_on
+ return diff.days >= 700
+
class Meta:
db_table = u'foundationmembers'
ordering = ['lastname', 'firstname']
Modified: branches/django/mango/views.py
==============================================================================
--- branches/django/mango/views.py (original)
+++ branches/django/mango/views.py Tue Jun 24 20:24:43 2008
@@ -261,10 +261,18 @@
for member in page.object_list:
membernode = ET.SubElement(el1, 'foundationmember')
membernode.set('id', unicode(member.id))
+ ET.SubElement(membernode, 'id').text = unicode(member.id)
for field in ('firstname', 'lastname', 'comments', 'email'):
node = ET.SubElement(membernode, field)
node.text = getattr(member, field)
- ET.SubElement(membernode, 'id').text = unicode(member.id)
+ for field in ('first_added', 'last_renewed_on'):
+ node = ET.SubElement(membernode, field)
+ node.text = unicode(getattr(member, field))
+ if member.is_member:
+ ET.SubElement(membernode, 'member')
+ if member.need_to_renew:
+ ET.SubElement(membernode, 'need_to_renew')
+
return get_xmlresponse(doc, "list_foundationmembers.xsl")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]