Adds attendee profile data to the attendee page

This commit is contained in:
Christopher Neugebauer 2016-09-20 12:08:03 +10:00
parent 6611546a35
commit e3b662fb67

View file

@ -3,6 +3,7 @@ import forms
import collections import collections
import datetime import datetime
from django.conf import settings
from django.contrib.auth.decorators import user_passes_test from django.contrib.auth.decorators import user_passes_test
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.db import models from django.db import models
@ -14,6 +15,7 @@ from django.shortcuts import render
from registrasion.controllers.item import ItemController from registrasion.controllers.item import ItemController
from registrasion.models import commerce from registrasion.models import commerce
from registrasion.models import people from registrasion.models import people
from registrasion import util
from registrasion import views from registrasion import views
from reports import get_all_reports from reports import get_all_reports
@ -27,6 +29,9 @@ def CURRENCY():
return models.DecimalField(decimal_places=2) return models.DecimalField(decimal_places=2)
AttendeeProfile = util.get_object_from_name(settings.ATTENDEE_PROFILE_MODEL)
@user_passes_test(views._staff_only) @user_passes_test(views._staff_only)
def reports_list(request): def reports_list(request):
''' Lists all of the reports currently available. ''' ''' Lists all of the reports currently available. '''
@ -375,6 +380,22 @@ def attendee(request, form, user_id=None):
reports = [] reports = []
profile_data = []
profile = people.AttendeeProfileBase.objects.get_subclass(
attendee=attendee
)
exclude = set(["attendeeprofilebase_ptr", "id"])
for field in profile._meta.get_fields():
if field.name in exclude:
# Not actually important
continue
if not hasattr(field, "verbose_name"):
continue # Not a publicly visible field
value = getattr(profile, field.name)
profile_data.append((field.verbose_name, value))
reports.append(ListReport("Profile", ["", ""], profile_data))
links = [] links = []
links.append(( links.append((
reverse(views.amend_registration, args=[user_id]), reverse(views.amend_registration, args=[user_id]),