django-pgtrigger icon indicating copy to clipboard operation
django-pgtrigger copied to clipboard

AttributeError in proxy models with multiple inheritance

Open g-nie opened this issue 1 year ago • 0 comments

Hello, we are getting the following error when adding a proxy model that extends more than 1 superclass.

if model_name is None:
>           app_label, model_name = app_label.split('.')
AttributeError: type object 'SomeMixin' has no attribute 'split'

It can be reproduced with this kind of setup for instance. The model doesn't even need to specify triggers:

class BaseModel(models.Model):
    pass

class SomeMixin:
    pass

class ProxyModel(SomeMixin, BaseModel):
    class Meta:
        proxy = True

Running makemigrations here will raise the error. I created a fork with a fix https://github.com/g-nie/django-pgtrigger/tree/multibase-proxies but I'm getting some test errors due to the fact that actual (weird) migration files are created in pgtrigger/tests/migrations and I can't seem to work around that. If someone could give me some pointers on how to fix the tests, that would be great. Then I can go ahead and open a PR.

g-nie avatar Jun 28 '23 10:06 g-nie