How to couple a contact base to a mailing list and sending newsletters throught Django ?
Imagine that we have an application containing some kind of profiles or something like the django.contrib.auth and you want to send newsletters to them and tracking the activity.
The content types application is used to link any Contact model instance to another model instance.
This allow you to create different kinds of contact linked to differents application, and retrieve the association at anytime.
This is particulary usefull with the templates variables if certain informations are located in the model instance linked.
The emencia.django.newsletter application will never send the newsletters registered in the site until you launch the send_newsletter command.
$ python manage.py send_newsletter
This command will launch the newsletters who need to be launched accordingly to the credits of the SMTP server of the newsletter.
That’s mean that not all newsletters will be expedied at the end of the command because if you use a public SMTP server you can be banished temporarly if you reach the sending limit.
To avoid banishment all the newsletters are not sended in the same time and immediately.
So it is recommanded to create a cronjob for launching this command every hours for example.
You have to make a symbolic link from emencia/django/newsletter/media/ directory to your media directory or make a copy named edn,
but if want to change this value, define NEWSLETTER_MEDIA_URL in the settings.py as appropriate.
It’s not recommended to use SQLite for production use. Because is limited to 999
variables into a SQL query, you can not create a Mailing List greater than this limitations
in the Django’s admin modules. Prefer MySQL ou PgSQL.
It can be usefull for the end user to have a WYSIWYG editor for the
creation of the newsletter. The choice of the WYSIWYG editor is free and
the described method can be applied for anything, but we will focus on
TinyMCE because he has many features and a usefull plugin for loading
templates within it.
First of all install the django-tinymce application into your project.
Now you will write a module called admin.py into the root directory of your
project. This module will override the NewsletterAdmin class provided by
emencia.django.newsletter with the TinyMCE editor and register the
overrided class into the admin site.
from django import forms
from django.contrib import admin
from tinymce.widgets import TinyMCE
from emencia.django.newsletter.models import Newsletter
from emencia.django.newsletter.admin import NewsletterAdmin
class NewsletterTinyMCEForm(forms.ModelForm):
content = forms.CharField(widget=TinyMCE(attrs={'cols': 150, 'rows': 80}))
class Meta:
model = Newsletter
class NewsletterTinyMCEAdmin(NewsletterAdmin):
form = NewsletterTinyMCEForm
admin.site.unregister(Newsletter)
admin.site.register(Newsletter, NewsletterTinyMCEAdmin)
The last step is to make a call to your module to load the code. A good
solution is to import the admin.py module in the urls.py file of your
project.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.