from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
+from wtem.models import Confirmation
from .middleware import get_current_request
from .models import Submission, Assignment, Attachment, exercises
return qs
def get_urls(self):
- urls = super(SubmissionAdmin, self).get_urls()
return patterns(
'',
url(r'^report/$', self.admin_site.admin_view(report_view), name='wtem_admin_report')
examiners = self.examiners_by_exercise.setdefault(exercise_id, [])
if user not in examiners:
examiners.append(user)
+ if submission.contact:
+ contact_body = submission.contact.body
+ submission.school = '%s %s' % (contact_body.get('school'), contact_body.get('school_address'))
def report_view(request):
response['Content-Disposition'] = 'attachment; filename="wyniki.csv"'
return response
+
+class ConfirmationAdmin(admin.ModelAdmin):
+ 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:
+ confirmation.send_mail()
+ resend_mail.short_description = "WyĆlij kod ponownie"
+
+ actions = [resend_mail]
+
admin.site.register(Submission, SubmissionAdmin)
admin.site.register(Assignment)
+admin.site.register(Confirmation, ConfirmationAdmin)