Coder Social home page Coder Social logo

django-dirtyfields's Introduction

Django Dirty Fields

Join the chat at https://gitter.im/romgar/django-dirtyfields

Published PyPI version

Github Actions Test status

Coveralls code coverage status

Read the Docs documentation status

Tracking dirty fields on a Django model instance. Dirty means that field in-memory and database values are different.

This package is compatible and tested with the following Python & Django versions:

Django Python
2.2, 3.0, 3.1 3.8, 3.9
3.2, 4.0 3.8, 3.9, 3.10
4.1 3.8, 3.9, 3.10, 3.11
4.2 3.8, 3.9, 3.10, 3.11, 3.12
5.0 3.10, 3.11, 3.12

Install

$ pip install django-dirtyfields

Usage

To use django-dirtyfields, you need to:

  • Inherit from DirtyFieldsMixin in the Django model you want to track.
from django.db import models
from dirtyfields import DirtyFieldsMixin

class ExampleModel(DirtyFieldsMixin, models.Model):
    """A simple example model to test dirty fields mixin with"""
    boolean = models.BooleanField(default=True)
    characters = models.CharField(blank=True, max_length=80)
  • Use one of these 2 functions on a model instance to know if this instance is dirty, and get the dirty fields:
    • is_dirty()
    • get_dirty_fields()

Example

>>> model = ExampleModel.objects.create(boolean=True,characters="first value")
>>> model.is_dirty()
False
>>> model.get_dirty_fields()
{}

>>> model.boolean = False
>>> model.characters = "second value"

>>> model.is_dirty()
True
>>> model.get_dirty_fields()
{'boolean': True, "characters": "first_value"}

Consult the full documentation for more information.

django-dirtyfields's People

Contributors

2019342a avatar aalebedev avatar amureki avatar anentropic avatar bashu avatar bparker98 avatar coagulant avatar dependabot[bot] avatar dotsbb avatar geyser avatar gitter-badger avatar harel avatar hernantz avatar hobbestigrou avatar hsmett avatar ihoru avatar jimrollenhagen avatar k4nar avatar kishorkunal-raj avatar lincolnpuzey avatar mesuutt avatar mounirmesselmeni avatar mrjmad avatar philippbosch avatar prajnamort avatar rlaager avatar romgar avatar smn avatar vapkarian avatar wolfg1969 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-dirtyfields's Issues

reset_state fails when combining update_fields and FIELDS_TO_CHECK

When you use FIELDS_TO_CHECK on a model and then save it using update_fields, and update_fields contains a field not in FIELDS_TO_CHECK you get a KeyError because it's trying to pull a field from new_state in reset_state() that is not there.

Quick and dirty repro case:

class TestModelWithSpecifiedFields(DirtyFieldsMixin, models.Model):
    boolean1 = models.BooleanField(default=True)
    boolean2 = models.BooleanField(default=True)
    FIELDS_TO_CHECK = ['boolean1']

tm = TestModelWithSpecifiedFields.objects.create()

tm.boolean1 = False
tm.boolean2 = False

# This is causing the KeyError
tm.save(update_fields=["boolean2"])

I'll have a PR up with a fix soon.

compare m2m

Using v.1.2.1 I'm trying to make a comparison between stored model.m2m.all() (which is a list) and the one about to be saved...

dirty_fields = self.get_dirty_fields( verbose=True, # get list of all referenced 'myField' check_m2m={'myField': set([instance.id for instance in self.myField.all()])})

So if the saved list is set([1,2,3]) and want to delete one set([1,2]), this is not captured. What am I doing wrong?

Handle transaction rollbacks

Currently, if we do:

tm.field = 'new field value'
tm.get_dirty_fields() #returns {'field': 'original field value'}
try:
    with transaction.atomic(): 
        tm.save()
        raise Exception #force a rollback
except Exception:
     pass
tm.get_dirty_fields() #returns {}

This behaviour is problematic, because field in-memory and database values are still different.

It seems like this will be tricky to solve.

We could have a property uncommitted_dirty_fields, which we could clear in an on_commit() signal, but I can't think of a way of setting dirty_fields = uncommitted_dirty_fields in the case of a rollback, since there is no on_rollback() signal.

edit: If we had some way of uniquely identifying the current transaction (I can't see one in current django api), we might be able set dirty_fields = uncommitted_dirty_fields inside get_dirty_fields() if transaction_at_time_of_last_save != current_transaction. Then there'd be some additional complexity from rollbacks inside nested transactions.

AttributeError: model object has no attribute 'id'

When running one of my tests (Django 1.9.8 and django-dirtyfields
1.0) I got this weird exception. My Assembly model does not have a id instead its primary key is called serial_number.

Is there an assumption anywhere that all models must have a id?

Traceback (most recent call last):
  File "/home/usr/repos/intranet/.../tests/models/test_assembly.py", line 257, in test_has_fault_true
    fault.assemblies.add(self.sut)
  File "/home/usr/.virtualenvs/intranet/lib/python2.7/site-packages/django/db/models/fields/related_descriptors.py", line 843, in add
    self._add_items(self.source_field_name, self.target_field_name, *objs)
  File "/home/usr/.virtualenvs/intranet/lib/python2.7/site-packages/django/db/models/fields/related_descriptors.py", line 1012, in _add_items
    model=self.model, pk_set=new_ids, using=db)
  File "/home/usr/.virtualenvs/intranet/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 192, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/home/usr/.virtualenvs/intranet/lib/python2.7/site-packages/dirtyfields/dirtyfields.py", line 115, in reset_state
    instance._original_m2m_state = instance._as_dict_m2m()
  File "/home/usr/.virtualenvs/intranet/lib/python2.7/site-packages/dirtyfields/dirtyfields.py", line 74, in _as_dict_m2m
    for f, model in get_m2m_with_model(self.__class__)
AttributeError: 'Assembly' object has no attribute 'id'

DateTimeField deepcopy causes error introduced in 1.2.1.

The library moved from a shallow copy to a deep copy while moving to 1.2.1 from 1.2. This caused my project's tests to fail when saving a model with a DateTimeField where auto_now=True is set. Haven't done any testing on whether this is the cause (that DateTimeField is the cause though, not sure whether that attribute is). I will try to come up with some tests the coming days as it's very late as I post this. But what was the reason for changing the shallow copy to a deep copy? Changing the deep copy to a shallow copy resolves the issue.

This is the exact field that's causing the issue:

last_modified = models.DateTimeField(
    auto_now=True,
    verbose_name=_('...'),
    help_text=_('...')
)

The traceback:

  File "/Users/Andreas/Development/Python/SomeProjectYay/project/app/models.py", line 218, in save
    super(SomeModel, self).save(*args, **kwargs)
  File "/Users/Andreas/.pyenv/versions/SomeProjectYay/lib/python3.5/site-packages/django/db/models/base.py", line 708, in save
    force_update=force_update, update_fields=update_fields)
  File "/Users/Andreas/.pyenv/versions/SomeProjectYay/lib/python3.5/site-packages/django/db/models/base.py", line 745, in save_base
    update_fields=update_fields, raw=raw, using=using)
  File "/Users/Andreas/.pyenv/versions/SomeProjectYay/lib/python3.5/site-packages/django/dispatch/dispatcher.py", line 192, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/Users/Andreas/.pyenv/versions/SomeProjectYay/lib/python3.5/site-packages/dirtyfields/dirtyfields.py", line 124, in reset_state
    new_state = instance._as_dict(check_relationship=True)
  File "/Users/Andreas/.pyenv/versions/SomeProjectYay/lib/python3.5/site-packages/dirtyfields/dirtyfields.py", line 69, in _as_dict
    all_field[field.name] = deepcopy(field_value)
  File "/Users/Andreas/.pyenv/versions/3.5.2/lib/python3.5/copy.py", line 182, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/Users/Andreas/.pyenv/versions/3.5.2/lib/python3.5/copy.py", line 291, in _reconstruct
    args = deepcopy(args, memo)
  File "/Users/Andreas/.pyenv/versions/3.5.2/lib/python3.5/copy.py", line 155, in deepcopy
    y = copier(x, memo)
  File "/Users/Andreas/.pyenv/versions/3.5.2/lib/python3.5/copy.py", line 223, in _deepcopy_tuple
    y = [deepcopy(a, memo) for a in x]
  File "/Users/Andreas/.pyenv/versions/3.5.2/lib/python3.5/copy.py", line 223, in <listcomp>
    y = [deepcopy(a, memo) for a in x]
  File "/Users/Andreas/.pyenv/versions/3.5.2/lib/python3.5/copy.py", line 182, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/Users/Andreas/.pyenv/versions/3.5.2/lib/python3.5/copy.py", line 292, in _reconstruct
    y = callable(*args)
TypeError: __init__() missing 2 required positional arguments: 'tz' and 'transition_type'

Python version: 3.5.2.
Django version: 1.9.12.

Recursion error with version 0.4

I am getting a maximum recursion error on a unit test after the switch to version 0.4. I assume it is being caused by the call to ._full_dict(), namely.

...
  File "/home/angelo/.virtualenvs/online/src/django/django/db/models/query.py", line 228, in iterator
    obj = model_cls(**dict(zip(init_list, row_data)))
  File "/home/angelo/.virtualenvs/online/local/lib/python2.7/site-packages/dirtyfields/dirtyfields.py", line 14, in __init__
    reset_state(sender=self.__class__, instance=self)
  File "/home/angelo/.virtualenvs/online/local/lib/python2.7/site-packages/dirtyfields/dirtyfields.py", line 56, in reset_state
    instance._original_state = instance._full_dict()
  File "/home/angelo/.virtualenvs/online/local/lib/python2.7/site-packages/dirtyfields/dirtyfields.py", line 17, in _full_dict
File "/home/angelo/.virtualenvs/online/src/django/django/forms/models.py", line 143, in model_to_dict
    data[f.name] = f.value_from_object(instance)
  File "/home/angelo/.virtualenvs/online/src/django/django/db/models/fields/__init__.py", line 560, in value_from_object
    return getattr(obj, self.attname)
  File "/home/angelo/.virtualenvs/online/src/django/django/db/models/query_utils.py", line 114, in __get__
    instance._state.db).get(pk=instance.pk),
  File "/home/angelo/.virtualenvs/online/src/django/django/db/models/query.py", line 304, in get
    num = len(clone)
  File "/home/angelo/.virtualenvs/online/src/django/django/db/models/query.py", line 77, in __len__
    self._fetch_all()
  File "/home/angelo/.virtualenvs/online/src/django/django/db/models/query.py", line 857, in _fetch_all
    self._result_cache = list(self.iterator())
  File "/home/angelo/.virtualenvs/online/src/django/django/db/models/query.py", line 228, in iterator
    obj = model_cls(**dict(zip(init_list, row_data)))
  File "/home/angelo/.virtualenvs/online/local/lib/python2.7/site-packages/dirtyfields/dirtyfields.py", line 14, in __init__
    reset_state(sender=self.__class__, instance=self)
  File "/home/angelo/.virtualenvs/online/local/lib/python2.7/site-packages/dirtyfields/dirtyfields.py", line 56, in reset_state
    instance._original_state = instance._full_dict()
  File "/home/angelo/.virtualenvs/online/local/lib/python2.7/site-packages/dirtyfields/dirtyfields.py", line 17, in _full_dict
    return model_to_dict(self)
  File "/home/angelo/.virtualenvs/online/src/django/django/forms/models.py", line 143, in model_to_dict
    data[f.name] = f.value_from_object(instance)
  File "/home/angelo/.virtualenvs/online/src/django/django/db/models/fields/__init__.py", line 560, in value_from_object
    return getattr(obj, self.attname)
...

Different creation behavior

If I do this:

model = Model()
model.field = x
assert model.is_dirty() == True

model = Model.objects.create(field=x)
assert model.is_dirty() == True  # raises assertion error

I believe both examples should behave like the first example.

Update PyPI?

Any chance you could update the version on PyPI? We're using this in production, and just ran into an issue with it that's fixed in master, but not in PyPI (v0.1).

Also, I saw you may be looking for a new owner of django-dirtyfields. I'd be happy to fill the role, if you still have a need.

Can not create new object

I try to use your app, for early created object it work, but when i try create new object with ForeignKey i catch error "RelatedObjectDoesNotExist"

class TestObject(DirtyFieldsMixin):
category = models.ForeignKey(Category)
title = models.CharField('Title', max_length=255, blank=True, default='')

Using F objects raise an exception when calling save

ValidationError
[u"'F(field_name) + Value(1)' value must be an integer."]

dirtyfields/dirtyfields.py ? in _as_dict

            if field.rel:
                if not check_relationship:
                    continue
            field_value = getattr(self, field.attname)
            all_field[field.name] = field.to_python(field_value) #This line

Django 1.10 compatibility issue

I have two models, Assembly and Location. An assembly may contain other assemblies so when a location changes, I want to make sure the location of all the sub-assemblies changes as well. The code to do this is:

    def save(self, *args, **kwargs):
        """Additions to the default abstract save method."""
        try:
            import ipdb; ipdb.set_trace()  # Used to get debugging info.
            if self.is_dirty(check_relationship=True):
                dirties = self.get_dirty_fields(check_relationship=True)
                if 'locality' in dirties.keys():
                    self.ripple_downwards('locality', self.locality)
        finally:
            super(Assembly, self).save(*args, **kwargs)

This used to work fine with dirtyfields version 0.8.2. However, with 1.1 it does not. Here is some debugging information:

ipdb> self.pk
1
ipdb> sut = Assembly.objects.get(pk=1)
ipdb> sut.pk == self.pk
True
ipdb> self.locality
<Location: Afghanistan>
ipdb> sut.locality is None
True
ipdb> self.get_dirty_fields(check_relationship=True)
{}

Am I doing something wrong?

Doesn't take internal conversions into account

With MySQL, I can pass a string "1" to an integer value, and somewhere along the line (Django? MySQL?) it will convert it as appropriate. However the comparisons performed by the mixin will attempt to compare the string I passed with the integer from the database, and since Python (for reasons that completely escape me…this burns me all the time), will not throw an error on the invalid comparison, but will simply return false. The result is that records will be marked dirty when in fact things have not changed.

I'm not sure how to fix this other than by replicating all the conversions prior to the first call to check for dirty fields. Or else to have the check for dirty fields do the conversions on the fly, which seems inefficient (remember, this includes converting strings to dates). Of course, this means it needs to deal with exceptions if bad data has been passed in (although perhaps in that case it's okay to just say "it's dirty").

post_save get_dirty_fields dict has fewer keys

Hello. Today, during tests, after upgrading to django dirtyfields 1.2, I noticed that get_dirty_fields returns a different dictionary during pre_save and post_save if I'm creating a new object.

In post_save, it will only show fields that were modifed during pre_save. In pre_save, it will show all fields, if it is a new model instance. Why is that? Is that expected?

Ideas of functionalities we could add to dirtyfields

By looking to some forks with really good ideas, I think we could improve/add dirtyfields functionalities, like (to be continued) :

  • Be able to save only dirty fields of a model with update logic.

If you have any ideas/needs, that the perfect issue to talk about it !!

Empty models.py not needed

Since the app loading refactor in Django 1.7, there has been no need for installed apps to have an empty models.py. Given that this doesn't actually need to be an installed app at all, there's no need to have it anyway.

get_dirty_fields after M2M.clear() problem

Hi,
I'm using django-dirtyfields==1.3.0
And find such a problem:
I've got a model - Order with two fields:

  • Vehicle - M2M field
  • start_datetime - Datetime field

I try to update start_datetime and delete all vehicles in my Order.
In the result I need to print in logs of usual fields(no FK and M2M), with their new values
In my function I got such code:

order.pickup_datetime = pickup_datetime
logger.debug(order.is_dirty())
logger.debug(order.get_dirty_fields())

order.vehicle.clear()

logger.debug(order.is_dirty())
logger.debug(order.get_dirty_fields())

order.save()

When I look in my logs file I see the following thing:

DEBUG

True
DEBUG {'pickup_datetime': datetime.datetime(2018, 12, 7, 15, 5)}
DEBUG False
DEBUG {}

As you see before .clear() everything is ok, but then something goes wrong.
And if I override order.save() method with self.get_dirty_fields() in it - I also got empty dict in the result.

What am I doing wrong?

Model loading issue after upgrade to 0.4

I have a model with multiple foreign keys. After upgrade to 0.4, it is very slow to loading the model objects, since there are a lot of queries for relation objects, even for getting a single object. Obviously it is a N+1 query problem.

KeyError in get_dirty_fields

I am investigating a weird problem I can only replicate in certain environments (Sempahore... and production.. annoyingly) where I get a keyerror from dirtyfields.

  File "env/src/django-dirtyfields/src/dirtyfields/dirtyfields.py", line 37, in get_dirty_fields
KeyError 'updated_at'
36:        for key, value in new_state.iteritems():
37:            original_value = self._original_state[key]

Any ideas what might be the cause of this @smn? Could the state being incorrectly frozen when the object is initialized? The updated_at field is a regular datetime for all intents and purposes and is simply updated by a signal like so:

@receiver(pre_save)
def timestampable(sender, instance, *args, **kwargs):
    if hasattr(instance, 'created_at'):
        if instance._state.adding and not instance.created_at:
            instance.created_at = timezone.now().replace(microsecond=0)

    if hasattr(instance, 'updated_at'):
        if instance._state.adding or not hasattr(instance, 'is_dirty') or instance.is_dirty():
            instance.updated_at = timezone.now().replace(microsecond=0)

I am not sure what I am doing to confuse it.

Improve update_fields handling with ForeignKey

Hello Hello!

When dealing with ForeignKeys, Django allows to provide the '{field_name}_id' fields name in the update_fields save parameter. So should you :)
To reproduce the error I got:

    tmwfk = TestModelWithForeignKey.objects.create(fkey=tm1)

    tmwfk.fkey = tm2
    tmwfk.save(update_fields=['fkey_id'])

My pull request is coming!
Thanks for your hard work!

KeyError when foreign key is initially set.

I've encountered an issue where dirtyfields throws a KeyError when check_relationship=True and a model is initially being saved, so _original_state is an empty dictionary. The fix is simple but I'm not sure if it would cause unexpected behavior for others.

The fix can be found here:
dalberto@fa4056b

"Specify fields to track" proposal

Hi! I think, it will be a good option - to specify a set of fields to track.

class MyDirtyFieldsMixin(dirtyfields.DirtyFieldsMixin):
    fields_to_track = ['name',]

class MyModel(models.Model, MyDirtyFieldsMixin):
    name = models.CharField(max_length=20)
    # 100 of other fields here

It can help to get performance improvements (I performed a some tests in my project). There is a such option in django-model-utils: https://django-model-utils.readthedocs.io/en/latest/utilities.html#tracking-specific-fields
If this idea is good, I can try to write a patch.

Release notes

Thanks for the great tool.

It would be nice if you had some version release notes to aid in upgrading from version to version.

Not working with Python3

The get_dirty_fields function uses dict.iteritems() which has been removed in Python3. Can we find a fix for that?

Performance hit in a django view

We saw a performance hit on one of our stats pages where we query around 800 rows of data each one of them has around 15-20 columns, some of them query json fields and some arrays.

We discovered that the issue is in django-dirtyfields, which we use a lot, but not in this specific view.

screenshot from 2018-09-05 21-19-42

There is no easy way to turn off the checks, we patched the _as_dict method as a workaround.

Would be great if we could have a way to turn the dirtyfields off in specific cases where its not needed and not just globally with FIELDS_TO_CHECK.

KeyError when using F object and update_fields

I'm getting a KeyError when trying to update a single field with an F object

model.my_field = F('my_field') + 1
model.save(update_fields=['my_field'])
# will raise a KeyError
model.save()
# Will work

_as_dict method will not contain my_field when I'm using F objects

_as_dict_m2m make a lot more extra queries

Hi,

_as_dict_m2m make extra queries even when I prefetch_related m2m fields.

My example is the following, A have a FK to B and B have a m2m to C
B is the only model using DirtyFieldMixin. Doing A.objects.all().prefetch_related('b__c') will not avoid extra queries.
Is there a way to avoid this or to disable m2m checks and initialisation?

Using only in conjunction with 2 foreign keys on a model broken

Hello,

I found a rather interesting edge case when using this library in a project.

Namely, it seems that having a model with 2 foreign keys, and applying ".only" to it's QuerySet makes it recurse forever.

class A(models.Model):
    pass

class B(DirtyFieldsMixin, models.Model):
    fkey1 = models.ForeignKey(A, null=True)
    fkey2 = models.ForeignKey(A, null=True, related_name='fkey2')

def test():
    a = A.objects.create()
    b = B.objects.create(fkey1=a, fkey2=a)
    for obj in B.objects.only('fkey1'):  # RuntimeError raised! Maximum recursion depth exceeded
        print obj

Seems like this happens through this line in dirtyfields.py, but I didn't really dig too far into it:

field_value = getattr(self, field.attname)

Is this still maintained?

I'm wondering if this is still under active development as it has been 6 months since last commit.

Handle enum comparison

I'm trying to track the changes for a text field where the choices are defined by an Enum class. For example:

class TestEnums(enum.Enum):
    one = 'One'
    two = 'Two'

class EnumFieldModel(DirtyFieldsMixin, models.Model):
    enum_field = models.TextField(choices=[(choice.name, choice.value) for choice in TestEnums])

Though this line is casting the instance to a string, so the original and current values aren't able to be compared properly.

getattr(self, 'enum_field')  # <TestEnums.two: 'Two'>
type(getattr(self, 'enum_field'))  # <enum 'TestEnums'>

self._original_state.get('enum_field')  # 'TestEnums.one'
type(self._original_state.get('enum_field'))  # <class 'str'>

I'd like to propose a small change to handle Enums more consistently. I'll be happy to take this on and submit a PR if this sounds ok.

get_dirty_fields fails if check_m2m is not None

Line 101 of dirtyfields.py
modified_m2m_fields = compare_states(check_m2m, self._original_m2m_state, self.compare_function)

should be

modified_m2m_fields = compare_states(self._as_dict_m2m(), self._original_m2m_state, self.compare_function)

next release?

When will the next release be made? Was in need of the new normalise_function.

Add support for enum

Django dirty field is not detecting changes for enum.

I was going through #140

I would like to work on enum support If the project is active.

The code doesn't consider it a change if a foreign key changes

I don't know if there's a general purpose solution to this, but:

def _as_dict(self):
return dict([(f.name, getattr(self, f.name)) for f in self._meta.local_fields if not f.rel])

specifically excludes foreign keys with the f.rel.

I ran into this because I'm explicitly setting foo_id to a value (my keys come from an xml file), and is_dirty didn't see the change because it doesn't examine those fields. I can't do it any other way (even if that would help) because I don't have a foreign key constraint—it's possible that the item I'm pointing at doesn't exist.

What case fails if the "if not f.rel" is removed?

datetime naive versus aware compare issue

In 0.8.1, At line 56 in dirtyfields.py, this comparison is failing because of naive vs aware datetimes. The check_relationship flag has the default value set to False.

  1.         if value != original_value:
    

Exception Type: TypeError at ***
Exception Value: can't compare offset-naive and offset-aware datetimes

Remove useless code (support < Dj 1.8 dropped)

in django-dirtyfields/tests/test_save_fields.py:
@unittest.skipIf(django.VERSION < (1, 5), "Django 1.4 doesn't support update_fields param on save()")

Those lines aren't usefull anymore :)

Deprecated warning for get_m2m_with_model

It looks like get_m2m_with_model has been deprecated. Here are the two warnings generated with the latest release:

/home/mike/workspace/venv3/lib/python3.4/site-packages/dirtyfields/dirtyfields.py:25: RemovedInDjango110Warning: 'get_m2m_with_model is an unofficial API that has been deprecated. You may be able to replace it with 'get_fields()'
  for m2m_field, model in self._meta.get_m2m_with_model():

/home/mike/workspace/venv3/lib/python3.4/site-packages/dirtyfields/dirtyfields.py:71: RemovedInDjango110Warning: 'get_m2m_with_model is an unofficial API that has been deprecated. You may be able to replace it with 'get_fields()'
  for f, model in self._meta.get_m2m_with_model()

New Pypi release

There is a big performance issue on the current version "0.5" with the related fields (FK or o2o), SQL queries count (Using Debug toolbar) can be from 20 to 400 and even more with this update (from "0.3" to "0.5")
This is not the case when installing directly from git.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.