(sender, instance, created, **kwargs)
Django signal that fires when BookToc model is being saved.

    This will only set "mark_section_as" setting to "mainmatter" to
    newly created Sections
Django signal that fires when BookToc model is being saved.
Django signal that fires when BookToc model is being saved .
def default_section_settings(sender, instance, created, **kwargs):
    """
    Django signal that fires when BookToc model is being saved.

    This will only set "mark_section_as" setting to "mainmatter" to
    newly created Sections
    """

    SECTION_TYPE = 0

    if created and instance.typeof == SECTION_TYPE:
        instance.settings = json.dumps({"mark_section_as": "mainmatter"})
        instance.save()
def default_section_settings ( sender , instance , created , * * kwargs ) : SECTION_TYPE = 0 if created and instance . typeof == SECTION_TYPE : instance . settings = json . dumps ( { "mark_section_as" : "mainmatter" } ) instance . save ( )