Skip to content

Instantly share code, notes, and snippets.

@dusan87
Created October 9, 2015 16:32
Show Gist options
  • Save dusan87/176138450f69d268d1cf to your computer and use it in GitHub Desktop.
Save dusan87/176138450f69d268d1cf to your computer and use it in GitHub Desktop.
"""
Design General model according example that is given.
The idea is to have item and characteristic models.
Where we can store characteristics such a RAM: 4gb and add to an Item.
"""
from django.db import models
class Characteristic(models.Model):
attribute = models.CharField("key", max_length=255)
value = models.CharField(max_lenght=255)
class Item(models.Model):
product = models.CharField(max_length=255)
characteristics = models.ManyToManyField('Characteristic')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment