def forwards(self, orm):
        """
        save triggers signal that will make a DonationJournal.
        """
        from bluebottle.journals.models import create_journal_for_sender

        for donation in orm.Donation.objects.all():
            # create journal for sender will normally be triggered by
            # donation.save()
            # but since that signal is not triggered via the migration, we do it manually
            # since the function usually gets class properties from Django models
            # we have to find away to avoid that and add in the required data in a dict
            data_dict = {
                'journal_class': orm['journals.DonationJournal'],
                'related_model_name': 'donation',
                'related_model_amount_field_name': 'amount',
            }
            create_journal_for_sender(sender=orm.Donation, instance=donation, created=False, data_migration=data_dict)
Beispiel #2
0
def create_donation_journal_after_donation_is_changed(sender, instance, created, **kwargs):
    create_journal_for_sender(sender=sender, instance=instance, created=created)