Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'ArrayField' has no attribute '_meta' #142

Open
robrichter opened this issue Nov 12, 2021 · 3 comments
Open

'ArrayField' has no attribute '_meta' #142

robrichter opened this issue Nov 12, 2021 · 3 comments

Comments

@robrichter
Copy link

robrichter commented Nov 12, 2021

I have django model with Postgres specific field type ArrayField

class Dataset(behaviors.CreatedEdited):
    fields = ArrayField(models.CharField(max_length=31), null=True)

When calling mixer.blend(Dataset) it fails:
FAILED dmx_server/apps/vydej/tests/test_orders.py::test_order - AttributeError: Mixer (<class 'dmx_server.apps.vydej.models.Publishset'>): type object 'ArrayField' has no attribute '_meta'

Error can be avoided by adding parameter on creation
mixer.blend(Dataset, fields=["aaa", "bbb"])

But I have more complicated use case where ArrayField is used in through model. When I set mixer.register(PublishsetsDataset, fields=None) I evade problem with ArrayField but creation fails anyway.

@nvo87
Copy link

nvo87 commented Jan 31, 2022

I have the same issue with Django models.JSONField.

@odigity
Copy link
Contributor

odigity commented Mar 18, 2022

I have the same issue with models.UUIDField in Django 3.0.

For some reason it doesn't complain if the id field is a UUIDField, but if I add any others, it blows up.

I think this SO is also about the same problem: https://stackoverflow.com/questions/43848109/geodjango-and-mixer-pointfield-has-no-attribute-meta

@odigity
Copy link
Contributor

odigity commented Mar 18, 2022

Just searched the code. Seems UUIDField is part of a list of supported types in the Mongo backend:

https://github.com/klen/mixer/blob/develop/mixer/backend/mongoengine.py#L119

But not the Django backend:

https://github.com/klen/mixer/blob/develop/mixer/backend/django.py#L82

Can this be easily fixed? It's a real ongoing problem, given that UUIDField is not only a standard Django field but also very popular and useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants