+class AbstractConfirmation(models.Model):
+ contact = models.ForeignKey('contact.Contact', null=True)
+ key = models.CharField(max_length=30)
+ confirmed = models.BooleanField(default=False)
+
+ class Meta:
+ abstract = True
+
+ def readable_contact(self):
+ return '%s <%s>' % (self.contact.body.get('przewodniczacy'), self.contact.contact)
+
+ def school_phone(self):
+ return '%s, tel. %s' % (self.contact.body.get('school'), self.contact.body.get('school_phone'))
+
+ def age(self):
+ return timezone.now() - self.contact.created_at
+
+ def readable_age(self):
+ td = self.age()
+ return '%s dni, %s godzin' % (td.days, td.seconds/3600)
+
+
+class Confirmation(AbstractConfirmation):