Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1122 from akatsoulas/export-attendance
Browse files Browse the repository at this point in the history
Add a resource for exporting the attendance in admin.
  • Loading branch information
akatsoulas committed Apr 4, 2016
2 parents be7bb6f + 6b06e2e commit d83da50
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions remo/events/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,24 @@ def owner_display_name(self, obj):
return obj.owner.userprofile.display_name


class AttendanceResource(resources.ModelResource):
user_full_name = fields.Field()
event_name = fields.Field()

class Meta:
model = Attendance
export_order = ['event_name', 'user_full_name']

def dehydrate_user_full_name(self, obj):
return obj.user.get_full_name()

def dehydrate_event_name(self, obj):
return obj.event.name


class AttendanceAdmin(ExportMixin, admin.ModelAdmin):
"""Attendance Admin"""
resource_class = AttendanceResource
model = Attendance
list_display = ('event', 'user', 'date_subscribed',)
search_fields = ('event__name', 'user__first_name', 'user__last_name',)
Expand Down

0 comments on commit d83da50

Please sign in to comment.