Ticket #15096: post_form_save.diff

File post_form_save.diff, 1.3 KB (added by jamesdabbs, 5 years ago)
  • django/db/models/signals.py

     
    1414post_syncdb = Signal(providing_args=["class", "app", "created_models", "verbosity", "interactive"])
    1515
    1616m2m_changed = Signal(providing_args=["action", "instance", "reverse", "model", "pk_set", "using"])
     17
     18post_form_save = Signal(providing_args=["instance"])
  • django/forms/models.py

     
    6767    If construct=False, assume ``instance`` has already been constructed and
    6868    just needs to be saved.
    6969    """
     70    from django.db.models import signals
    7071    if construct:
    7172        instance = construct_instance(form, instance, fields, exclude)
    7273    opts = instance._meta
     
    8283                continue
    8384            if f.name in cleaned_data:
    8485                f.save_form_data(instance, cleaned_data[f.name])
     86        # Signal that the save is complete
     87        signals.post_form_save.send(sender=form.__class__, instance=instance)
    8588    if commit:
    8689        # If we are committing, save the instance and the m2m data immediately.
    8790        instance.save()
Back to Top