do creepy metaclass stuff in wrappers.py

This commit is contained in:
Laura Klünder 2017-06-13 18:52:16 +02:00
parent da9a7c5130
commit e3c8947883
3 changed files with 35 additions and 16 deletions

View file

@ -120,7 +120,7 @@ class ChangeSet(models.Model):
if isinstance(obj, type) and issubclass(obj, models.Model):
return ModelWrapper(self, obj, author)
if isinstance(obj, models.Model):
return ModelInstanceWrapper(self, obj, author)
return ModelWrapper(self, type(obj), author).create_wrapped_model_class()(self, obj, author)
raise ValueError
def _new_change(self, author, **kwargs):