mango r271 - in branches/django: . mango
- From: ovitters svn gnome org
- To: svn-commits-list gnome org,gnome-sysadmin gnome org
- Subject: mango r271 - in branches/django: . mango
- Date: Fri, 27 Jun 2008 22:21:28 +0000 (UTC)
Author: ovitters
Date: Fri Jun 27 22:21:28 2008
New Revision: 271
URL: http://svn.gnome.org/viewvc/mango?rev=271&view=rev
Log:
* mango/models.py (Foundationmembers, FoundationmembersForm,
FoundationmembersForm.clean): Allow foundation membership to be
renewed.
Modified:
branches/django/ (props changed)
branches/django/ChangeLog
branches/django/mango/models.py
Modified: branches/django/mango/models.py
==============================================================================
--- branches/django/mango/models.py (original)
+++ branches/django/mango/models.py Fri Jun 27 22:21:28 2008
@@ -10,7 +10,7 @@
from django.db import models
from django.conf import settings
from django.core import validators
-from django.newforms import ModelForm
+from django.newforms import ModelForm, BaseModelForm, BooleanField
from django.utils import tree
from django.db.models import Q
import ldap
@@ -57,7 +57,7 @@
comments = models.TextField(blank=True)
userid = models.CharField(max_length=15, null=True, blank=True)
first_added = models.DateField(auto_now_add=True)
- last_renewed_on = models.DateField(null=True, blank=True, editable=False)
+ last_renewed_on = models.DateField(null=True, blank=True)
last_update = models.DateTimeField(auto_now=True)
resigned_on = models.DateField(null=True, blank=True)
@@ -75,6 +75,23 @@
ordering = ['lastname', 'firstname']
class FoundationmembersForm(ModelForm):
+ renew = BooleanField(required=False)
+
+ def clean(self):
+ data = self.cleaned_data
+
+ if self.is_bound:
+ if data.get('renew', None) and self.instance.is_member:
+ data['last_renewed_on'] = datetime.date.today()
+ else:
+ data['last_renewed_on'] = self.instance.last_renewed_on
+ else:
+ if 'last_renewed_on' in data: data['last_renewed_on'] = datetime.date.today()
+ if 'resigned_on' in data: data['resigned_on'] = None
+
+
+ return data
+
class Meta:
model = Foundationmembers
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]