How to use the coderedcms.models.wagtailsettings_models.GeneralSettings.for_site function in coderedcms

To help you get started, we’ve selected a few coderedcms examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github coderedcorp / coderedcms / coderedcms / models / page_models.py View on Github external
key.replace('_', ' ').title(),
                value
            ))

        content = '\n-------------------- \n'.join(content)

        # Build email message parameters
        message_args = {
            'body': content,
            'to': addresses,
        }
        if self.subject:
            message_args['subject'] = self.subject
        else:
            message_args['subject'] = self.title
        genemail = GeneralSettings.for_site(request.site).from_email_address
        if genemail:
            message_args['from_email'] = genemail
        if self.reply_address:
            # Render reply-to field using form submission as context.
            context = Context(self.data_to_dict(processed_data, request))
            template_reply_to = Template(self.reply_address)
            message_args['reply_to'] = template_reply_to.render(context).split(',')

        # Send email
        message = EmailMessage(**message_args)
        message.send()