summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshen2018-02-12 10:07:56 +0530
committerAkshen2018-02-12 10:07:56 +0530
commitb944fd4895db0a542aebd44206c3c508dd5c3c50 (patch)
treed98ad1887000a1f8d29572e34a6f6cd143925c6f
parent4df54e589dc4f828f966e0cd1b4c63156f574238 (diff)
downloadworkshop_booking-b944fd4895db0a542aebd44206c3c508dd5c3c50.tar.gz
workshop_booking-b944fd4895db0a542aebd44206c3c508dd5c3c50.tar.bz2
workshop_booking-b944fd4895db0a542aebd44206c3c508dd5c3c50.zip
Add First and Last name column while downloading profile data
- First name and Last name added in admin.py ProfileAdmin class for making it downloadable
-rw-r--r--workshop_app/admin.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/workshop_app/admin.py b/workshop_app/admin.py
index a28cdb3..40d496f 100644
--- a/workshop_app/admin.py
+++ b/workshop_app/admin.py
@@ -14,7 +14,8 @@ except ImportError:
#Custom Classes
class ProfileAdmin(admin.ModelAdmin):
- list_display = ['title','user', 'institute','location','department','phone_number','position']
+ list_display = ['title','user', 'institute','location','department',
+ 'phone_number','position']
list_filter = ['position', 'department']
actions = ['download_csv']
@@ -25,11 +26,13 @@ class ProfileAdmin(admin.ModelAdmin):
filename=profile_data.csv'
writer = csv.writer(response)
- writer.writerow(['title','user', 'institute', 'location','department','phone_number',
- 'position'])
+ writer.writerow(['title','username', 'first_name', 'last_name',
+ 'institute', 'location', 'department',
+ 'phone_number', 'position'])
for q in queryset:
- writer.writerow([q.title, q.user, q.institute,
+ writer.writerow([q.title, q.user, q.user.first_name,
+ q.user.last_name, q.institute,
q.location, q.department, q.phone_number,
q.position])