m = Model(title="m", some="some m")
m.save()
m1 = Model1(title="m1", some="some m1", m=m)
m1.save()
m2 = Model2(title="m2", some="some m2", m1=m1)
m2.save()
m3 = Model3(title="m3", some="some m3", m2=m2)
m3.save()
m3_all = Model3.objects.all()
m3_all[0].m2.m1.m.some
'some m'
def roomupdate(request, id):
if request.POST:
sensor = request.POST.get("sensors")
room = Room.objects.get(id=id)
room.sensors_set.add(Sensors.objects.get(name=sensor))
room.save()
request.POST.get("sensors")
room, _* = Rooms.objects.get_or_create(name="Комната 1")
room.sensors ....
room.save()
class SensorUpdate(UpdateView():
model = Rooms
делаем правила дропа и занесения в блэклист обращения к типичным, но не задействованым портам (telnet, ftp, ssh, sql, mysql, sip и тп)