Remove docs for setting up post_delete signals on custom document models

This is no longer required as of #3541
pull/3853/merge
Matt Westcott 2017-09-13 11:57:05 +01:00
rodzic 243f7eb02a
commit 665d06c8ce
1 zmienionych plików z 0 dodań i 13 usunięć

Wyświetl plik

@ -10,9 +10,6 @@ You need to complete the following steps in your project to do this:
- Create a new document model that inherits from
``wagtail.wagtaildocs.models.AbstractDocument``. This is where you would
add additional fields.
- Add a signal handler to duplicate the post-delete behaviour from
``wagtaildocs.signal_handlers.post_delete_document_file_cleanup```.
This ensures the uploaded file is cleaned up when a document is deleted.
- Point ``WAGTAILDOCS_DOCUMENT_MODEL`` to the new model.
Here's an example:
@ -20,9 +17,6 @@ Here's an example:
.. code-block:: python
# models.py
from django.db.models.signals import post_delete
from django.dispatch import receiver
from wagtail.wagtaildocs.models import Document, AbstractDocument
class CustomDocument(AbstractDocument):
@ -40,13 +34,6 @@ Here's an example:
'source',
)
# Add the signal handler.
# The sender kwarg should match up with your custom document model name.
@receiver(post_delete, sender=CustomDocument)
def post_delete_document_file_cleanup(sender, instance, **kwargs):
# See wagtaildocs.signal_handlers.post_delete_document_file_cleanup
instance.file.delete(False)
.. note::
Fields defined on a custom document model must either be set as non-required