Switch to side-by-side view

--- a/OSSEval/entity/models.py
+++ b/OSSEval/entity/models.py
@@ -15,19 +15,33 @@
 from OSSEval.utils import xmlMinidom
 
 class Entity(models.Model):
+    '''
+    An Entity is the Open Source Project or the IMDB Movie; each
+    entity comes with a module/app
+    The class Instance (from analysis.models) will be related 1 to 1
+    with the class defined in the module/app; e.g. OSProject and IMDBMovie: see
+    actual_instance_accessor below
+    '''
     name = models.CharField(max_length=200)
-    actual_entity_class = models.CharField(max_length=200) #the class that implements the actual entity instance
-    actual_entity_app = models.CharField(max_length=200) #the app where the above classes are
+    #the class that implements the actual entity instance
+    actual_entity_class = models.CharField(max_length=200)
+    #the module/app where the above class is
+    actual_entity_app = models.CharField(max_length=200)
+    # the name of the accessor (related_name) to go from analysis.Instance
+    # to the actual_instance e.g. the OSProject or IMDBMovie instance.
+    actual_instance_accessor = models.CharField(max_length=200)
+    
     def from_xml(self, xmldoc, insert = True):
         if not insert:
             self.id = xmlMinidom.getNaturalAttribute(xmldoc, 'Id')
         self.name = xmlMinidom.getStringAttribute(xmldoc, 'Name')
         self.actual_entity_class = xmlMinidom.getStringAttribute(xmldoc, 'ActualEntityClass')
         self.actual_entity_app = xmlMinidom.getStringAttribute(xmldoc, 'ActualEntityApp')
+        self.actual_instance_accessor = xmlMinidom.getStringAttribute(xmldoc, 'ActualInstanceAccessor')
         # I save so I get the ID (if insert == True)
         self.save()
     def to_xml(self):
-        return '<Entity Id="' + str(self.id) + '" Name="' + self.name + '" ActualEntityClass="' + self.actual_entity_class + '" ActualEntityApp="' + self.actual_entity_app + '"/>'
+        return '<Entity Id="' + str(self.id) + '" Name="' + self.name + '" ActualEntityClass="' + self.actual_entity_class + '" ActualEntityApp="' + self.actual_entity_app + '" ActualInstanceAccessor="' + self.actual_instance_accessor + '"/>'
     
     def __str__(self):
         return self.name