jazzband / django-eav2

Django EAV 2 - EAV storage for modern Django
https://django-eav2.readthedocs.io/
Other
334 stars 57 forks source link

Operations like Delete EAV or change name, data type of field #616

Open amitchavan90 opened 1 month ago

amitchavan90 commented 1 month ago

Provide a general summary of the issue in the title above. Operations like Delete EAV or change name, data type of EAV

Detailed Description

We want to allow dynamically added fields management. Currently with django-eav2 we can allow our users to add new fields on models. But how can we allow them to Delete the already added fields or change name of the existing field or change data type of the field?

Context

Why is this change important to you? How would you use it? How can it benefit other users? Added fields needs more management like update, delete. I believe it is the need for everyone.

Possible Implementation

Not obligatory, but you may suggest an idea for implementing addition or change. May be a QuerySet implementation for the same can help easily. Also, this functionality might be there in the library but it is not mentioned anywhere in the documentation.

Dresdn commented 1 month ago

If I'm reading you correctly, you're specifically referring to allowing users to change the models.Attribute objects, correct? To do what you're looking at, treat Attribute like any other Django model object.

You'll probably want to create a custom EavConfig so the attributes are associated correctly, especially if they're dynamic.

One other thing you can do is add an m2m field on whatever object to the eav.models.Attribute field, combined with the get_attributes() override, and now you can dynamically associate attributes to a given object.

Hope this gets you pointed in the right direction.