fnp
/
edumed.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d83b04c
)
contact and age in confirmation admin
author
Jan Szejko
<janek37@gmail.com>
Tue, 12 Sep 2017 12:35:31 +0000
(14:35 +0200)
committer
Jan Szejko
<janek37@gmail.com>
Tue, 12 Sep 2017 12:35:31 +0000
(14:35 +0200)
wtem/admin.py
patch
|
blob
|
history
wtem/models.py
patch
|
blob
|
history
diff --git
a/wtem/admin.py
b/wtem/admin.py
index
2fa38aa
..
d581de0
100644
(file)
--- a/
wtem/admin.py
+++ b/
wtem/admin.py
@@
-240,8
+240,8
@@
def report_view(request):
class ConfirmationAdmin(admin.ModelAdmin):
class ConfirmationAdmin(admin.ModelAdmin):
- list_display = ('email', 'first_name', 'last_name', 'confirmed')
- readonly_fields = ('contact', 'readable_contact', 'key', 'confirmed')
+ list_display = ('email', 'first_name', 'last_name', '
readable_contact', 'readable_age', '
confirmed')
+ readonly_fields = ('contact', 'readable_contact', '
readable_age', '
key', 'confirmed')
def resend_mail(self, request, queryset):
for confirmation in queryset:
def resend_mail(self, request, queryset):
for confirmation in queryset:
diff --git
a/wtem/models.py
b/wtem/models.py
index
96d85b6
..
f745aeb
100644
(file)
--- a/
wtem/models.py
+++ b/
wtem/models.py
@@
-11,6
+11,7
@@
from django.core.exceptions import ValidationError
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
+from django.utils import timezone
from django.utils.translation import ugettext as _
from jsonfield import JSONField
from django.utils.translation import ugettext as _
from jsonfield import JSONField
@@
-216,6
+217,13
@@
class Confirmation(models.Model):
def readable_contact(self):
return '%s <%s>' % (self.contact.body.get('przewodniczacy'), self.contact.contact)
def readable_contact(self):
return '%s <%s>' % (self.contact.body.get('przewodniczacy'), self.contact.contact)
+ 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)
+
def send_mail(self):
mail_subject = render_to_string('contact/olimpiada/student_mail_subject.html').strip()
mail_body = render_to_string(
def send_mail(self):
mail_subject = render_to_string('contact/olimpiada/student_mail_subject.html').strip()
mail_body = render_to_string(