SOS - HELP : I am newbie in django ( I came from PHP (Laravel)): I need modeling the data : I have same models they are named Sources like(IOT, Sensosr, Totens, app etc..) each source has your particularity(conection params) and similarity, then I have scans, scans use sources information to execute (store information about execution) and produce activities on hosts.
I need to link activities to sources through scans, so that, when a activity is showed, information about hosts, scans, and source are showed. I learning about abstract but it not so clear !
@dirkgroten thanks for your time, Im Edited it to be more precise
look this models:
code
class Sensor (models.Model):
creation_date = models.DateTimeField(auto_now=True)
...fields
class Crawler (models.Model):
creation_date = models.DateTimeField(auto_now=True)
...fields
code
They are my Sources Models , where data Activities came from...
then
code
class Scan (models.Model):
creation_date = models.DateTimeField(auto_now=True)
# Here I neet to link with a source, but source could be a Crawler, IOT, Sensor or API model
...fields
class Host (models.Model):
creation_date = models.DateTimeField(auto_now=True)
...fields
class Activities (models.Model):
creation_date = models.DateTimeField(auto_now=True)
host = models.ForeignKey('Host',on_delete='DELETE')
scan = models.ForeignKey('Scan',on_delete='DELETE')
code
When I list to Show a activities I need to show information about scan and where they come from (source) like (Activity.Host or Activit.Scan.Source.) In PHP my Scan table had a "source" flag and an ID field, so I knew in which table to fetch the data from the source. I know this is not the right way so I want to do this well done using ORM. if you can help me I will be very grateful.