[Answered ]-Django: Signal callback function missing foreign on model

2👍

Solved it. The ‘sender’ argument is just a class object, not an instance. In my callback I can reference the instance by the kwargs like:
blog_entry_instance = kwargs[“instance”]

So the callback function would look like this:

@receiver(post_save, sender=BlogEntry)
def project_blog_entry_signal(sender, **kwargs):
    log = Log()
    log.project = kwargs["instance"].project
    log.content_type = Log.content_new_blogentry
    log.save()

Leave a comment