import requests from django.conf import settings from gauth.models import Location from analytics.send_email import send_email def send_email_weekly_summary(): # locations = Location.objects.all() locations = Location.objects.filter(location_id='3511292162159714121') for location in locations: to = getattr(settings, 'ADMIN_MAINTEINER_EMAILS') to.append(location.recipient_email) if location.recipient_email else None subject = f"Weekly report for {location.care_name}." url = f'http://127.0.0.1:8000/analytics/weekly-report/{location.location_id}' message_body = requests.get(url).text message_body += '

Regards,

Byte Trek Team

' send_email(to_list=to, subject=subject, message=message_body)