Customer wants to extend my Models

Django, ORM and migrations are great.

But if the customer wants to be able to extend some models on his own (without Python knowledge, by using the GUI), then I am clueless. Up to now I found no solution to this.

Has someone an idea how to solve this?

That’s because there isn’t one - at least not a clean/safe/secure method. Unlike some other CMSs (e.g. Drupal) that have an abstraction layer between the “framework” models and “user content” models, Django’s models all correspond directly to tables.

Now, there might be an existing Python-based CMS providing that type of facility, but I’m not aware of any - and Django isn’t it.

I agree with KenWhitesell that this is probably something that seems likely to create more trouble than its worth. You could consider if a system for tagging objects with extra information would satisfy, (probably ContentTypes), but for normal tag systems you could have diverse tags but they’d all be of the same type.

An alternate, flexible model is EntityAttributeValue, in which your customer could define an Attribute and Value for that attribute for an entity. The paradigm case in which this is useful (according to this writeup for Django-EAV2 https://github.com/makimo/django-eav2) is for objects that might have any of a very large set of attributes but probably only have a handful. But there’s a risk that in a year’s time the customer has gone to town and put heaps of confused, redundant, conflicting data into the EAV table and its affecting performance negatively. I hope that’s useful, or at least interesting.

1 Like

Thank you for your answer.