We currently have an inventory system for our employees. It contains laptops, phones, but also ergonomic chairs, fridges or software licenses ... So very different stuff tha
The Satchmo project is a django based e-commerce solution, which allows to manage different products and different options for a given products. Maybe you could find some inspiration in there.
Another great tool for inheritance and polymorphism management is the Django model utils project, and the InheritanceManager
it provides.
I'm using in in production, to manage different kind of products (shirts, jackets, etc.), and it's really helpful.
** Edit **
As requested, an example of a inheritance.
class Product(models.Model):
objects = InheritanceManager()
client = models.ForeignKey('clients.Client')
price = models.PositiveIntegerField()
class Shirt(Product):
color = …
class Pants(Product):
…
products = Product.objects.all().select_subclasses()
# products[0] can be a Shirt, and products[1] can be a Pants
Note that I had to tweak a few things to make the code work with select_related
, because of this issue.
Ok ... at the time of the writing, Django is just not good with that.
Schema-free databases such as mongodb are a good solution for this problem, and Django simply doesn't support those out of the box.
So I gave up Django, and rewrote the whole thing in node.js
with a mongodb database.