-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tracking pull request to merge release-1.57.0 to master (#2104)
* update Minio to object storage (#2105) * feat: zeva-2093 - add checkbox (#2097) * feat: zeva-2093 - add checkbox * add missing prop type * Added functionality to download email list with organizations attached for filtering (#2107) * fix ZEVA 2091: credit application table filter missing some submitted records (#2094) * fix: adds recommended and checked submissions to the queryset filter if the bceid user searches anything that matches submitted * chore: cleans up code * edit logic location --------- Co-authored-by: tim738745 <tim.chen@gov.bc.ca> * Removing lock on generated excel sheet to allow for sorting/filtering (#2108) * fix: zeva-2106 - report history (#2111) * fix: zeva-2098 - credit applications list date display (#2114) * roll back minio changes --------- Co-authored-by: tim738745 <98717409+tim738745@users.noreply.github.com> Co-authored-by: JulianForeman <71847719+JulianForeman@users.noreply.github.com> Co-authored-by: Emily <44536222+emi-hi@users.noreply.github.com> Co-authored-by: tim738745 <tim.chen@gov.bc.ca>
- Loading branch information
1 parent
a248150
commit b370c4e
Showing
13 changed files
with
175 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from django.http import HttpResponse | ||
import io | ||
import xlwt | ||
from datetime import datetime | ||
from api.models.user_profile import UserProfile | ||
|
||
BOLD = xlwt.easyxf('font: name Times New Roman, bold on;') | ||
|
||
def create_bceid_emails_sheet(): | ||
sheet_name = 'Active BCeID Emails' | ||
|
||
output = io.BytesIO() | ||
workbook = xlwt.Workbook('Emails.xls') | ||
workbook.protect = True | ||
|
||
descriptor = { | ||
'version': 2, | ||
'create_time': datetime.utcnow().timestamp(), | ||
'sheets': [] | ||
} | ||
|
||
worksheet = workbook.add_sheet(sheet_name) | ||
descriptor['sheets'].append({ | ||
'index': 1, | ||
'name': sheet_name | ||
}) | ||
|
||
row = 0 | ||
|
||
worksheet.write(row, 0, 'Organization', style=BOLD) | ||
worksheet.write(row, 1, 'Email', style=BOLD) | ||
|
||
users = UserProfile.objects.filter(is_active=True).exclude(organization__is_government='True').values('organization__name', 'email') | ||
|
||
users_list = list(users) | ||
|
||
for user in users_list: | ||
row += 1 | ||
if user['email'] and user['organization__name']: | ||
worksheet.write(row, 0, user['organization__name']) | ||
worksheet.write(row, 1, user['email']) | ||
|
||
org_col = worksheet.col(0) | ||
org_col.width = 256 * 30 | ||
|
||
email_col = worksheet.col(1) | ||
email_col.width = 256 * 30 # 30 characters for VIN | ||
|
||
workbook.save(output) | ||
output.seek(0) | ||
|
||
filename = 'active_bceid_users.xls' | ||
response = HttpResponse(output.getvalue(), content_type='application/vnd.ms-excel') | ||
response['Content-Disposition'] = f'attachment; filename="{filename}"' | ||
|
||
return response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.