Требуется помощь в написание Views и самой формы.
Имеем две модели
class Sensors(models.Model):
name = models.CharField(max_length=150)
class Rooms(models.Model):
name = models.CharField(max_length=150, blank=False)
x = models.SmallIntegerField()
y = models.SmallIntegerField()
h = models.SmallIntegerField()
sensors = models.ManyToManyField(Sensors, blank=True)
urls:
path('sensortoroom/<int:room_id>', sensortoroom, name='sensortoroom'),
views который требуется дописать
def sensortoroom(request, room_id):
room = Rooms.objects.filter(id=room_id)
form = Addsensortoroom()
return render(request, 'room/addsensortoroom.html')