Django: Представление не возвращало объект HttpResponse. Вместо этого оно возвращало None. Когда переопределение Form_Valid

Я отменил метод form_valid в моем представлении RobotDetail, но всякий раз, когда я пытаюсь использовать представление, я получаю ошибку The view dashboard.views.RobotDetail didn't return an HttpResponse object. It returned None instead. Если кто-нибудь знает, как это исправить, буду очень признателен! ВИД

from django.shortcuts import render
from django.views.generic import ListView, DetailView, UpdateView
from .models import Robot
from .forms import RobotUpdateForm
import socket
import threading
HEADER = 64
PORT = 6060
SERVER = socket.gethostbyname(socket.gethostname())
ADDR = (SERVER, PORT)
FORMAT = 'utf-8'
DISCONNECT_MESSAGE = "!DISCONNECT!"

class RobotDetail(UpdateView):
    model = Robot
    form_class = RobotUpdateForm
    template_name = 'dashboard/robotdetail.html'

    def form_valid(self, form):
        self.object = form.save()
        client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        client.connect(ADDR)

        def send(msg):
            message = msg.encode(FORMAT)
            msg_length = len(message)
            send_length = str(msg_length).encode(FORMAT)
            send_length += b' ' * (HEADER - len(send_length))
            client.send(send_length)
            client.send(message)

        send("Hello World!")
        send("Hello Andrew")
        send("Hello")
        send(DISCONNECT_MESSAGE)

МОДЕЛЬ

class Robot(models.Model):
    def fetch_choices():
        scope = [REDACTED]
        creds = ServiceAccountCredentials.from_json_keyfile_name("dashboard/Files/creds.json", scope)
        client = gspread.authorize(creds)
        sheet = client.open("tutorial").sheet1
        path_names = []
        path_name_fetch =  sheet.col_values(1)
        for i in path_name_fetch:
            if (i, i) not in path_names:
                path_names.append((i, i))
        return path_names

    name = models.CharField(max_length=200)
    path_options = models.CharField(choices=fetch_choices(), default=fetch_choices(), max_length=100)
    status_choices = [('waiting', 'waiting'), ('running', 'running'), ('stuck', 'stuck')]
    current_status = models.CharField(choices=status_choices, default=status_choices[0], max_length=100)

    def __str__(self):
        return self.name + ' | Current Status: ' + self.current_status

    def get_absolute_url(self):
        return reverse('dashboard-home')

ШАБЛОН

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Dashboard</title>
</head>
<body>
    {% extends 'theblog/base.html' %}
    {% block content %}
        <h1>Dispatcher</h1>
        <form method="POST">
            {% csrf_token %}
            {{ form.as_p}}
            <button class="btn btn-secondary">Dispatch</button>
        </form>
    {% endblock %}
</body>
</html>
Вернуться на верх