def ready(self): from wagtail.documents.signal_handlers import register_signal_handlers register_signal_handlers() # Set up model forms to use AdminDocumentChooser for any ForeignKey to the document model from wagtail.admin.forms.models import register_form_field_override from .widgets import AdminDocumentChooser Document = get_document_model() register_form_field_override( ForeignKey, to=Document, override={"widget": AdminDocumentChooser} )
def setUp(self): # Required to create root collection because the TransactionTestCase # does not make initial data loaded in migrations available and # serialized_rollback=True causes other problems in the test suite. # ref: https://docs.djangoproject.com/en/1.10/topics/testing/overview/#rollback-emulation Collection.objects.get_or_create( name="Root", path='0001', depth=1, numchild=0, ) #: Sadly signal receivers only get connected when starting django. #: We will re-attach them here to mimic the django startup behavior #: and get the signals connected to our custom model.. signal_handlers.register_signal_handlers()
def ready(self): from wagtail.documents.signal_handlers import register_signal_handlers register_signal_handlers()