mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Cleaned up EmailMultiAlternatives docs.
This commit is contained in:
		| @@ -397,11 +397,27 @@ Django's email library, you can do this using the | |||||||
|  |  | ||||||
| .. class:: EmailMultiAlternatives | .. class:: EmailMultiAlternatives | ||||||
|  |  | ||||||
|     A subclass of :class:`~django.core.mail.EmailMessage` that allows |     A subclass of :class:`EmailMessage` that allows additional versions of the | ||||||
|     additional versions of the message body in the email via the |     message body in the email via the :meth:`attach_alternative` method. This | ||||||
|     ``attach_alternative()`` method. This directly inherits all methods |     directly inherits all methods (including the class initialization) from | ||||||
|     (including the class initialization) from |     :class:`EmailMessage`. | ||||||
|     :class:`~django.core.mail.EmailMessage`. |  | ||||||
|  |     .. attribute:: alternatives | ||||||
|  |  | ||||||
|  |         A list of named tuples with attributes ``(content, mimetype)``. This is | ||||||
|  |         particularly useful in tests:: | ||||||
|  |  | ||||||
|  |             self.assertEqual(len(msg.alternatives), 1) | ||||||
|  |             self.assertEqual(msg.alternatives[0].content, html_content) | ||||||
|  |             self.assertEqual(msg.alternatives[0].mimetype, "text/html") | ||||||
|  |  | ||||||
|  |         Alternatives should only be added using the :meth:`attach_alternative` | ||||||
|  |         method. | ||||||
|  |  | ||||||
|  |         .. versionchanged:: 5.2 | ||||||
|  |  | ||||||
|  |             In older versions, ``alternatives`` was a list of regular tuples, | ||||||
|  |             as opposed to named tuples. | ||||||
|  |  | ||||||
|     .. method:: attach_alternative(content, mimetype) |     .. method:: attach_alternative(content, mimetype) | ||||||
|  |  | ||||||
| @@ -420,24 +436,6 @@ Django's email library, you can do this using the | |||||||
|             msg.attach_alternative(html_content, "text/html") |             msg.attach_alternative(html_content, "text/html") | ||||||
|             msg.send() |             msg.send() | ||||||
|  |  | ||||||
|     .. attribute:: alternatives |  | ||||||
|  |  | ||||||
|         A list of named tuples with attributes ``(content, mimetype)``. This is |  | ||||||
|         particularly useful in tests:: |  | ||||||
|  |  | ||||||
|             self.assertEqual(len(msg.alternatives), 1) |  | ||||||
|             self.assertEqual(msg.alternatives[0].content, html_content) |  | ||||||
|             self.assertEqual(msg.alternatives[0].mimetype, "text/html") |  | ||||||
|  |  | ||||||
|         Alternatives should only be added using the |  | ||||||
|         :meth:`~django.core.mail.EmailMultiAlternatives.attach_alternative` |  | ||||||
|         method. |  | ||||||
|  |  | ||||||
|         .. versionchanged:: 5.2 |  | ||||||
|  |  | ||||||
|             In older versions, ``alternatives`` was a list of regular tuples, as opposed |  | ||||||
|             to named tuples. |  | ||||||
|  |  | ||||||
| Updating the default content type | Updating the default content type | ||||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user