title: What model/approach to use to relate space and objects in django
body: <p>I'm trying to play a little with django so I've started to create a &quot;solution&quot; to an old problem I have.
  My background at OO programming and models relation is not that much so I ask for ideas/paths/solutions on how to achieve my goals.</p>
  <p>My problem:</p>
  <ul>
  <li><p>I need to define spatial objects and relate them
  ex: Building 1, inside we have floor 1 and 2, inside floor 2 we have room A and B</p>
  </li>
  <li><p>At each type of &quot;location&quot; I will place &quot;things&quot;
  ex: place 1 camera at building 1; place 1 camera at floor 2; place 1 camera at room B</p>
  </li>
  <li><p>So I can archive the results bellow:
  Building 1: 3 cameras
  floor 2: 2 cameras
  room B: 1 camera</p>
  </li>
  </ul>
  <p>I was planning to archieve this using the old method of a table for each kind of object (building, floor, room) but I'm a little stuck on how to deal with diferent stuff the same way (actions) specialy because after dealing with this I have to put &quot;people&quot; at the equation, ie, I can put person J at room 2 and put a camera on him.</p>
  <p>I thank you all in advance on all the thoughts (even if it is to say forget it and code it) because I a little lost here :)</p>
  <p>Sorry if this is not the correct way (1st post):
  @Amun_Re
  I'm not that good with words, specially in English. The models you posted where my first database object relation, but after discovering the many to many relation I was thinking (and because I need to put objects in room and floor and building and they are differente) that django/python had a better way to deal with this.
  I'll try to post an image of what I have designed for this phase.</p>
  <p>Well, after rethinking all the things I'm trying an OO perspective. If they are going to be treated as same, they at least need to have come from the same place.
  Right now I have a class &quot;object&quot; that all other classes inherit from (building, floor, person,...) but right now I have an issue, when I try to place a person on a building I get the error:</p>
  <pre><code>from django.db import models
  from numpy import source
  from objects.models import Asset, Object
  # Create your models here.
  
  class UseType(models.Model):
      name = models.CharField(max_length=100, unique=True)
  
      def __str__(self):
          return str(self.name)
  
  
  class Placement(models.Model):
      my_usetype = models.ForeignKey(UseType, on_delete=models.CASCADE)
      my_source = models.ForeignKey(Object, on_delete=models.CASCADE)
      my_destination = models.ForeignKey(Object, on_delete=models.CASCADE)
  
      created = models.DateTimeField(auto_now_add=True)
      updated = models.DateTimeField(auto_now=True)
  
      def __str__(self):
          return str(self.created)
  </code></pre>
  <p>Can I even do this? Or should I use only integer fields instead of the foreighkeys and update then on a form only?</p>
  <p>TIA</p>