def send_registered_vessels_email(content): email_obj = TemplateEmailBase() email_obj.subject = 'Lotus notes extract run.' email_obj.html_template = 'mooring/email/reg_ves.html' email_obj.txt_template = 'mooring/email/reg_ves.txt' # if not settings.PRODUCTION_EMAIL: # emails.append(settings.NON_PROD_EMAIL) # else: emails = [] admin_emails = settings.NOTIFICATION_EMAIL ae = admin_emails.split(',') for i in ae: emails.append(i) loc = AdmissionsLocation.objects.filter(key='ria') if loc.count() > 0: group = loc[0].mooring_group if group: for mem in group.members.all(): if is_admin(mem): emails.append(mem.email) context = {'content': content} email_obj.send(emails, from_address=default_from_email, context=context)
def mooring_url(request): web_url = request.META.get('HTTP_HOST', None) tg = 'pvs' if web_url in settings.ROTTNEST_ISLAND_URL: tg = 'ria' else: tg = 'pvs' authed = request.user.is_authenticated mooring_url = mooring_url_group(tg) is_officer = False is_inventory = False is_admin = False is_payment_officer = False is_customer = False failed_refund_count = 0 if authed: if request.user.is_staff or request.user.is_superuser: failed_refund_count = models.RefundFailed.objects.filter( status=0).count() is_officer = helpers.is_officer(request.user) is_inventory = helpers.is_inventory(request.user) is_admin = helpers.is_admin(request.user) is_payment_officer = helpers.is_payment_officer(request.user) is_customer = helpers.is_customer(request.user) mooring_url['REFUND_FAILED_COUNT'] = failed_refund_count mooring_url['IS_OFFICER'] = is_officer mooring_url['IS_INVENTORY'] = is_inventory mooring_url['IS_ADMIN'] = is_admin mooring_url['IS_PAYMENT_OFFICER'] = is_payment_officer mooring_url['IS_CUSTOMER'] = is_customer return mooring_url
def send_registered_vessels_email(content): email_obj = TemplateEmailBase() email_obj.subject = 'Lotus notes extract run.' email_obj.html_template = 'mooring/email/reg_ves.html' email_obj.txt_template = 'mooring/email/reg_ves.txt' # if not settings.PRODUCTION_EMAIL: # emails.append(settings.NON_PROD_EMAIL) # else: emails = [] admin_emails = settings.NOTIFICATION_EMAIL ae = admin_emails.split(',') for i in ae: emails.append(i) loc = AdmissionsLocation.objects.filter(key='ria') if loc.count() > 0: group = loc[0].mooring_group if group: for mem in group.members.all(): if is_admin(mem): emails.append(mem.email) context = { 'content': content } email_obj.send(emails, from_address=default_from_email, context=context)
def mooring_url(request): #web_url = request.META['HTTP_HOST'] web_url = request.META.get('HTTP_HOST', None) if web_url in settings.ROTTNEST_ISLAND_URL: template_group = 'rottnest' TERMS = "https://www.rottnestisland.com/~/media/Files/boating-documents/marine-hire-facilities-tcs.pdf?la=en" PUBLIC_URL = 'https://mooring-ria.dbca.wa.gov.au/' mooring_group = 'ria' else: template_group = 'pvs' TERMS = "/know/online-mooring-site-booking-terms-and-conditions" PUBLIC_URL = 'https://mooring.dbca.wa.gov.au' mooring_group = 'pvs' is_officer = False is_inventory = False is_admin = False is_payment_officer = False is_customer = False failed_refund_count = 0 if request.user.is_authenticated: if request.user.is_staff or request.user.is_superuser: failed_refund_count = models.RefundFailed.objects.filter( status=0).count() is_officer = helpers.is_officer(request.user) is_inventory = helpers.is_inventory(request.user) is_admin = helpers.is_admin(request.user) is_payment_officer = helpers.is_payment_officer(request.user) is_customer = helpers.is_customer(request.user) return { 'EXPLORE_PARKS_SEARCH': '/map', 'EXPLORE_PARKS_CONTACT': '/contact-us', 'EXPLORE_PARKS_CONSERVE': '/know/conserving-our-moorings', 'EXPLORE_PARKS_PEAK_PERIODS': '/know/when-visit', 'EXPLORE_PARKS_ENTRY_FEES': '/know/entry-fees', 'EXPLORE_PARKS_TERMS': TERMS, 'PARKSTAY_EXTERNAL_URL': settings.PARKSTAY_EXTERNAL_URL, 'DEV_STATIC': settings.DEV_STATIC, 'DEV_STATIC_URL': settings.DEV_STATIC_URL, 'TEMPLATE_GROUP': template_group, 'GIT_COMMIT_DATE': settings.GIT_COMMIT_DATE, 'GIT_COMMIT_HASH': settings.GIT_COMMIT_HASH, 'SYSTEM_NAME': settings.SYSTEM_NAME, 'REFUND_FAILED_COUNT': failed_refund_count, 'IS_OFFICER': is_officer, 'IS_INVENTORY': is_inventory, 'IS_ADMIN': is_admin, 'IS_PAYMENT_OFFICER': is_payment_officer, 'IS_CUSTOMER': is_customer, 'PUBLIC_URL': PUBLIC_URL, 'MOORING_GROUP': mooring_group }
def mooring_url(request): web_url = request.META['HTTP_HOST'] if web_url in settings.ROTTNEST_ISLAND_URL: template_group = 'rottnest' TERMS = "https://www.rottnestisland.com/boating/moorings/Rental%20Moorings%20and%20Jetty%20Pens" else: template_group = 'pvs' TERMS = "/know/online-mooring-site-booking-terms-and-conditions" is_officer = False is_inventory = False is_admin = False is_payment_officer = False is_customer = False failed_refund_count = 0 if request.user.is_authenticated: if request.user.is_staff or request.user.is_superuser: failed_refund_count = models.RefundFailed.objects.filter( status=0).count() is_officer = helpers.is_officer(request.user) is_inventory = helpers.is_inventory(request.user) is_admin = helpers.is_admin(request.user) is_payment_officer = helpers.is_payment_officer(request.user) is_customer = helpers.is_customer(request.user) return { 'EXPLORE_PARKS_SEARCH': '/map', 'EXPLORE_PARKS_CONTACT': '/contact-us', 'EXPLORE_PARKS_CONSERVE': '/know/conserving-our-moorings', 'EXPLORE_PARKS_PEAK_PERIODS': '/know/when-visit', 'EXPLORE_PARKS_ENTRY_FEES': '/know/entry-fees', 'EXPLORE_PARKS_TERMS': TERMS, 'PARKSTAY_EXTERNAL_URL': settings.PARKSTAY_EXTERNAL_URL, 'DEV_STATIC': settings.DEV_STATIC, 'DEV_STATIC_URL': settings.DEV_STATIC_URL, 'TEMPLATE_GROUP': template_group, 'GIT_COMMIT_DATE': settings.GIT_COMMIT_DATE, 'GIT_COMMIT_HASH': settings.GIT_COMMIT_HASH, 'SYSTEM_NAME': settings.SYSTEM_NAME, 'REFUND_FAILED_COUNT': failed_refund_count, 'IS_OFFICER': is_officer, 'IS_INVENTORY': is_inventory, 'IS_ADMIN': is_admin, 'IS_PAYMENT_OFFICER': is_payment_officer, 'IS_CUSTOMER': is_customer }
def mooring_url(request): web_url = request.META['HTTP_HOST'] if web_url in settings.ROTTNEST_ISLAND_URL: template_group = 'rottnest' TERMS = "https://www.rottnestisland.com/boating/moorings/Rental%20Moorings%20and%20Jetty%20Pens" else: template_group = 'pvs' TERMS = "/know/online-mooring-site-booking-terms-and-conditions" is_officer = False is_inventory = False is_admin = False is_payment_officer = False is_customer = False failed_refund_count = 0 if request.user.is_authenticated: if request.user.is_staff or request.user.is_superuser: failed_refund_count = models.RefundFailed.objects.filter(status=0).count() is_officer = helpers.is_officer(request.user) is_inventory = helpers.is_inventory(request.user) is_admin = helpers.is_admin(request.user) is_payment_officer = helpers.is_payment_officer(request.user) is_customer = helpers.is_customer(request.user) return { 'EXPLORE_PARKS_SEARCH': '/map', 'EXPLORE_PARKS_CONTACT': '/contact-us', 'EXPLORE_PARKS_CONSERVE': '/know/conserving-our-moorings', 'EXPLORE_PARKS_PEAK_PERIODS': '/know/when-visit', 'EXPLORE_PARKS_ENTRY_FEES': '/know/entry-fees', 'EXPLORE_PARKS_TERMS': TERMS, 'PARKSTAY_EXTERNAL_URL': settings.PARKSTAY_EXTERNAL_URL, 'DEV_STATIC': settings.DEV_STATIC, 'DEV_STATIC_URL': settings.DEV_STATIC_URL, 'TEMPLATE_GROUP' : template_group, 'GIT_COMMIT_DATE' : settings.GIT_COMMIT_DATE, 'GIT_COMMIT_HASH' : settings.GIT_COMMIT_HASH, 'SYSTEM_NAME' : settings.SYSTEM_NAME, 'REFUND_FAILED_COUNT': failed_refund_count, 'IS_OFFICER' : is_officer, 'IS_INVENTORY' : is_inventory, 'IS_ADMIN' : is_admin, 'IS_PAYMENT_OFFICER' : is_payment_officer, 'IS_CUSTOMER' : is_customer }
def is_admin(user): return helper.is_admin(user)
def is_admin(user): return helper.is_admin(user)