Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A Django app for adding object tools for models in the admin

Project Description

dj-obj-update is a module that helps you do two things while updating an object:

  1. Only do a save if something changed
  2. Log what changed (the logger name is obj_update and only outputs DEBUG)


pip install dj-obj-update


Updating an object

from obj_update import obj_update

new_data = {
    'flavor': 'chocolate',
for obj in queryset:
    obj_update(obj, new_data)

Replacement for update_or_create

from obj_update import obj_update_or_create

choice, created = obj_update_or_create(
    defaults={'choice_text': 'Flour or corn?'},

Logging changes

Using python-json-logger:

import logging
from pythonjsonlogger.jsonlogger import JsonFormatter

logger = logger.getLogger('obj_update')
handler = logging.FileHandler('log/my_obj_changes.log')
Release History

Release History

This version
History Node


History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
dj_obj_update-0.2.1-py2.py3-none-any.whl (4.5 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Aug 2, 2015
dj-obj-update-0.2.1.tar.gz (2.7 kB) Copy SHA256 Checksum SHA256 Source Aug 2, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting