Here is my model:
class Item(models.Model):
name = models.CharField(max_length=30)
...
choices = (
('weapon', 'weapon'),
('shield', 'shield'),
)
typeOf = models.CharField(max_length=15, choices=choices)
class Character(models.Model):
name = models.CharField(max_length=30, unique=True)
...
weapon = models.ForeignKey(Inventory) // **THIS IS WHAT I WANT TO DE BUT DOES'NT WORK**
shield = models.ForeignKey(Inventory) // **THIS IS WHAT I WANT TO DE BUT DOES'NT WORK**
inventory = models.ManyToManyField(Item, through='Inventory')
class Inventory(models.Model):
character = models.ForeignKey('Character')
item = models.ForeignKey('Item')
I know how to add item to inventory but now I want to equip them. How do I do the foreign key? I want to be able to equip weapon from my inventory