# Django how to save object status in signals?

**URL:** <https://forum.djangoproject.com/t/django-how-to-save-object-status-in-signals/8384>\
**Category:** Using Django\
**Created:** [June 17, 2021, 12:18am UTC](https://forum.djangoproject.com/t/django-how-to-save-object-status-in-signals/8384 "2021-06-17T00:18:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MDFARHYN](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/mdfarhyn/32/4519_2.png) [@MDFARHYN](https://forum.djangoproject.com/u/MDFARHYN)\
**Post date:** [June 17, 2021, 12:18am UTC](https://forum.djangoproject.com/t/django-how-to-save-object-status-in-signals/8384/1 "2021-06-17T00:18:59Z")

</div>

I am using signals in my model. The status of blog post will be pending for admin approval when any user try to edit existing blog post. But when I trying to change status from pending to published from my admin panel, it’s keeping the old status **“pending”**. How to change new status from admin panel? here is my code:

**models.py**

```auto
def post_update(sender,instance,*args,**kwargs):
           if instance:
               instance = Blog.objects.filter(is_published="published").update(is_published="pending")

post_save.connect(Blog.post_update,sender=Blog)

```

---

<div class="post-metadata">

**Author:** ![CodenameTim](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/codenametim/32/31507_2.png) [@CodenameTim](https://forum.djangoproject.com/u/CodenameTim)\
**Post date:** [June 17, 2021, 7:02pm UTC](https://forum.djangoproject.com/t/django-how-to-save-object-status-in-signals/8384/2 "2021-06-17T19:02:05Z")

</div>

Hi,

How do you know when the model can actually be published? It sounds like it’s based on the saving user’s credentials. If that’s the case, if you have a ForeignKey on Blog to User for whichever user saved updated it, you could check to see if they are admin or staff, then perform the update. The difficulty here is that this signal is raised whenever the blog is saved, so an admin editing a blog post could potentially bypass the review.

If the above changes your data model too much for your tastes, you may want to consider setting `is_published` to `"pending"` in your application where you save the model and remove this signal handler. Without additional context, that handler isn’t going to be able to determine when it should be published or pending.

-Tim
