Skip to main content

A simple Django app to store email template in database.

Project description

The application allows you to store email templates in the database. The application also allows you to edit templates in the database data using ckeditor. More details about the settings available ckeditor.

Installing

Install the application using pip.

> pip install django-mail-dbtpl

Add application settings Django project

INSTALLED_APPS = (
...
'django_mail_dbtpl',
...
)

Apply migration

python ./manage.py migrate django_mail_dbtpl

Usage

After installation, you must create a letter template in the database via the administration panel by url http://127.0.0.1:8000/admin/django_mail_dbtpl/emailtemplate/, it is necessary for the template specify slug. slug will be used for both identifier template. The templates can be determined context variables {{var}}. For example, you create a template with slug = 'welcome.tpl', subject = 'Welcome, {{username}}', body = 'Welcome to the {{site}}.'. The following is the code that shows how to use the template stored in the database

from django_mail_dbtpl.utils import EmailWrapper
context = {
    'username': 'Example User',
    'site': 'example.com'
}
msg = EmailWrapper('welcome.tpl', context)
msg.from_email = 'from_email@example.com'
msg.to = ['to_email@example.com']
msg.send()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-mail-dbtpl-0.2.2.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file django-mail-dbtpl-0.2.2.tar.gz.

File metadata

File hashes

Hashes for django-mail-dbtpl-0.2.2.tar.gz
Algorithm Hash digest
SHA256 f314492832ca8e2be5af6f071bb3bddf4bbd51758a5d6d413f359d8e4471fbf4
MD5 6ba55b4fb63a103aaee6b174fd7dc0c9
BLAKE2b-256 31e7f43161d009c6ed840ba680a538196aafd678ec9dba6140d16180cafc98fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page