{ "info": { "author": "ted kaemming", "author_email": "ted@disqus.com", "bugtrack_url": null, "classifiers": [], "description": "django-mailviews\n================\n\nClass-based email views for the Django framework, including a message previewer.\n\n.. image:: https://travis-ci.org/disqus/django-mailviews.png?branch=master\n :target: https://travis-ci.org/disqus/django-mailviews\n\nIntroduction\n------------\n\nRendering and sending emails in Django can quickly become repetitive and\nerror-prone. By encapsulating message rendering within view classes, you can\neasily compose messages in a structured and clear manner.\n\nBasic Usage\n-----------\n\n.. code:: python\n\n from mailviews.messages import EmailMessageView\n\n # Subclass the `EmailMessageView`, adding the templates you want to render.\n class WelcomeMessageView(EmailMessageView):\n subject_template_name = 'emails/welcome/subject.txt'\n body_template_name = 'emails/welcome/body.txt'\n\n # Instantiate and send a message.\n message = WelcomeMessageView().send(extra_context={\n 'user': user,\n }, to=(user.email,))\n\nThis isn't actually the best pattern for sending messages to a user -- read the\nnotes under \"Best Practices\" for a better approach.\n\nUsing the Preview Site\n----------------------\n\nRegistering URLs and Enabling Discovery\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n* Add ``mailviews`` to your project's ``INSTALLED_APPS`` setting.\n* Add the following somewhere within your project's ``ROOT_URLCONF``:\n\n.. code:: python\n\n from mailviews.previews import autodiscover, site\n\n autodiscover()\n\n urlpatterns = patterns('',\n url(regex=r'^emails/', view=site.urls),\n )\n\nThe preview index will now be available at the ``emails/`` URL.\n\nCreating Preview Classes\n~~~~~~~~~~~~~~~~~~~~~~~~\n\nTo create a simple preview, add a ``emails.previews`` submodule within one of your\n``INSTALLED_APPS``, and create a new subclass of ``Preview``.\n\n.. code:: python\n\n from mailviews.previews import Preview, site\n from example.emails.views import WelcomeMessageView\n\n # Define a new preview class.\n class BasicPreview(Preview):\n message_view = WelcomeMessageView\n\n # Register the preview class with the preview index.\n site.register(BasicPreview)\n\nYou can see more detailed examples within the `test suite `_\nor in the code documentation for ``mailviews.previews``.\n\nCustomizing Preview Behavior\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nYou can also use Django forms to customize the creation of message previews by\nadding a ``form_class`` attribute to your ``Preview`` subclasses. The form must\nprovide a ``get_message_view_kwargs`` method that returns a the keyword arguments\nto be used when constructing the message view instance.\n\nBest Practices\n--------------\n\n* Try and avoid using the ``extra_context`` argument when sending emails.\n Instead, create an ``EmailMessageView`` subclass whose constructor accepts\n as arguments all of the objects that you require to generate the context and\n send the message. For example, the code shown in \"Basic Usage\" could written\n instead as the following:\n\n.. code:: python\n\n from mailviews.messages import EmailMessageView\n\n class WelcomeMessageView(EmailMessageView):\n subject_template_name = 'emails/welcome/subject.txt'\n body_template_name = 'emails/welcome/body.txt'\n\n def __init__(self, user, *args, **kwargs):\n super(WelcomeMessageView, self).__init__(*args, **kwargs)\n self.user = user\n\n def get_context_data(self, **kwargs):\n context = super(WelcomeMessageView, self).get_context_data(**kwargs)\n context['user'] = self.user\n return context\n\n def render_to_message(self, *args, **kwargs):\n assert 'to' not in kwargs # this should only be sent to the user\n kwargs['to'] = (self.user.email,)\n return super(WelcomeMessageView, self).render_to_message(*args, **kwargs)\n\n # Instantiate and send a message.\n WelcomeMessageView(user).send()\n\nIn fact, you might find it helpful to encapsulate the above \"message for a user\"\npattern into a mixin or subclass that provides a standard abstraction for all\nuser-related emails. (This is left as an exercise for the reader.)\n\nTesting and Development\n-----------------------\n\nTested on Python 2.6, 2.7 and 3.4 (where supported by Django) and Django\nversions 1.3 through 1.8. (For specific versions supported, see the Travis or\nTox build matrices.) To run tests against the entire build matrix locally, run\n``make test-matrix`` (or ``tox``, if already installed.)\n\nDevelopment\n~~~~~~~~~~~\n\nTo install the project in development mode, run:\n\n.. code:: shell\n\n make develop\n\nThis installs dependencies, as well as builds static assets.\n\nTesting\n~~~~~~~\n\nTo run the test suite against your installed Django version, run:\n\n.. code:: shell\n\n python -m mailviews.tests\n\nTo view an example preview site, you can start a test server by running:\n\n.. code:: shell\n\n python -m mailviews.tests.manage runserver\n\nIntegration with Third-Party Applications\n`````````````````````````````````````````\n\nAll tests will automatically be run using the Django test runner when you run\nthe tests for your own projects if you use ``python manage.py test`` and\n``mailviews`` is within your ``settings.INSTALLED_APPS``.\n\n\nCoverage\n~~~~~~~~\n\nTo generate a Coverage report using coverage.py_, run:\n\n.. code:: shell\n\n coverage run --source=. -m mailviews.tests\n\n\n.. _coverage.py: https://pypi.python.org/pypi/coverage/\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/disqus/django-mailviews/", "keywords": null, "license": "Apache License 2.0", "maintainer": null, "maintainer_email": null, "name": "django-mailviews", "package_url": "https://pypi.org/project/django-mailviews/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-mailviews/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/disqus/django-mailviews/" }, "release_url": "https://pypi.org/project/django-mailviews/0.6.5/", "requires_dist": null, "requires_python": null, "summary": "Class-based mail views for Django", "version": "0.6.5" }, "last_serial": 2243432, "releases": { "0.5.1": [ { "comment_text": "", "digests": { "md5": "b753ddf3b01b4bb542797ac00b114333", "sha256": "a7452601b0dca83ede2cd2127dc0eabc72e276bfe388cba301467c6cab58351a" }, "downloads": -1, "filename": "django-mailviews-0.5.1.tar.gz", "has_sig": false, "md5_digest": "b753ddf3b01b4bb542797ac00b114333", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 120060, "upload_time": "2013-02-14T22:07:00", "url": "https://files.pythonhosted.org/packages/5f/e7/b571dbe34a60b29e97a3e9a6ebe6328532c453538d32e6f2a738b1b9c1e8/django-mailviews-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "641951c4b79c6b3260c252b17134cebb", "sha256": "e6be936c93f1baed64aee59d4aff3ab144dff7a8b3aef104c99817772b8e69b1" }, "downloads": -1, "filename": "django-mailviews-0.5.2.tar.gz", "has_sig": false, "md5_digest": "641951c4b79c6b3260c252b17134cebb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 120257, "upload_time": "2013-04-01T20:41:16", "url": "https://files.pythonhosted.org/packages/76/0e/d4779571eac6dc29ed59e4c6d65de2e2da38dc1548bb769c054edfc9f569/django-mailviews-0.5.2.tar.gz" } ], "0.5.3": [ { "comment_text": "", "digests": { "md5": "a15b98f666b3f4d3c7f65a6415c2f548", "sha256": "746b5f81d8eb4d9c5660b82849ae00638d80e138b080bfef936291afde9a843e" }, "downloads": -1, "filename": "django-mailviews-0.5.3.tar.gz", "has_sig": false, "md5_digest": "a15b98f666b3f4d3c7f65a6415c2f548", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 120249, "upload_time": "2013-09-28T05:15:34", "url": "https://files.pythonhosted.org/packages/56/cf/4dbcce240689d3b49c96a5c1f5bbd9689c71623e94894a1582b7e51ceefe/django-mailviews-0.5.3.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "65a9cbb27404351b352be84add2c3a79", "sha256": "479d3c3f4d4b0e6330e05d664338a51b819841ff146fa101ca1203243ead6bd1" }, "downloads": -1, "filename": "django-mailviews-0.6.0.tar.gz", "has_sig": false, "md5_digest": "65a9cbb27404351b352be84add2c3a79", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 120266, "upload_time": "2013-10-18T18:33:22", "url": "https://files.pythonhosted.org/packages/31/dc/9331b14ecc425de7fbf6ec8cee070245fcde3c427743e37f26a9778d4fb7/django-mailviews-0.6.0.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "cb885b00d32bfdfa6fa7dc44b0606c50", "sha256": "5f4988db96e31a8a787677213abb83fd1213fd0bdde4d036fe87381e70def9d2" }, "downloads": -1, "filename": "django-mailviews-0.6.1.tar.gz", "has_sig": false, "md5_digest": "cb885b00d32bfdfa6fa7dc44b0606c50", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 120266, "upload_time": "2013-10-21T18:27:30", "url": "https://files.pythonhosted.org/packages/9d/0e/2cf55b034ca7c833b31f65fa4fd87806cb72dc999868400ff2661c221f88/django-mailviews-0.6.1.tar.gz" } ], "0.6.2": [ { "comment_text": "", "digests": { "md5": "83f322912f17bd7910d182937dbed978", "sha256": "75d5eb845e8d0aa29039b47c9f31ccea7c68985207f611b2b8c5b01555a4d7e3" }, "downloads": -1, "filename": "django-mailviews-0.6.2.tar.gz", "has_sig": false, "md5_digest": "83f322912f17bd7910d182937dbed978", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 120526, "upload_time": "2014-02-04T03:40:05", "url": "https://files.pythonhosted.org/packages/43/e4/fc8ce0aaed9bf4111bb97ff7bb7ca97f05b8998aa63a04431e790b386f6d/django-mailviews-0.6.2.tar.gz" } ], "0.6.3": [ { "comment_text": "", "digests": { "md5": "56281c68af995e0cf0fa73d474291bf9", "sha256": "37ed9ea6c172b456778d858b42e840b851c1d919e39bd7bce5bd7a9a98e5a994" }, "downloads": -1, "filename": "django-mailviews-0.6.3.tar.gz", "has_sig": false, "md5_digest": "56281c68af995e0cf0fa73d474291bf9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 143133, "upload_time": "2014-02-04T19:17:08", "url": "https://files.pythonhosted.org/packages/4f/d8/5d6349cdad1e0acd028f7309d7037b245008c3010949c9336bbce1a29ae1/django-mailviews-0.6.3.tar.gz" } ], "0.6.4": [ { "comment_text": "", "digests": { "md5": "94db9171985af08dc560e326d4cbd28b", "sha256": "0b90ece8987c3e94b68bbbc356a2d70381c96642d10f13bd9a468922eed88bc2" }, "downloads": -1, "filename": "django-mailviews-0.6.4.tar.gz", "has_sig": false, "md5_digest": "94db9171985af08dc560e326d4cbd28b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 142776, "upload_time": "2015-07-23T22:56:37", "url": "https://files.pythonhosted.org/packages/43/c2/6f8c308c6769cf53ab600997d794b3c5b0b4ae2f0613012907988117f432/django-mailviews-0.6.4.tar.gz" } ], "0.6.5": [ { "comment_text": "", "digests": { "md5": "ff4abc4a7633f72550bf65d033bdd655", "sha256": "553929e31f80f86355afda86a49ee1e033a29a5656b8a34f1d4e264426dd2804" }, "downloads": -1, "filename": "django-mailviews-0.6.5.tar.gz", "has_sig": false, "md5_digest": "ff4abc4a7633f72550bf65d033bdd655", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 143036, "upload_time": "2015-07-23T23:55:02", "url": "https://files.pythonhosted.org/packages/31/93/362fe42e4568b39ad3fa10ff111193472cf5cd3e58360f3c4a9acfa56c2d/django-mailviews-0.6.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ff4abc4a7633f72550bf65d033bdd655", "sha256": "553929e31f80f86355afda86a49ee1e033a29a5656b8a34f1d4e264426dd2804" }, "downloads": -1, "filename": "django-mailviews-0.6.5.tar.gz", "has_sig": false, "md5_digest": "ff4abc4a7633f72550bf65d033bdd655", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 143036, "upload_time": "2015-07-23T23:55:02", "url": "https://files.pythonhosted.org/packages/31/93/362fe42e4568b39ad3fa10ff111193472cf5cd3e58360f3c4a9acfa56c2d/django-mailviews-0.6.5.tar.gz" } ] }