Django Form: Drop-Down/Select Not Rendering

class beacon(models.Model):
    host_id = models.BigAutoField('Id', primary_key=True)
    hostname = models.CharField('Hostname', max_length=200)
    internalIp = models.CharField('Internal-IP', max_length=200)
    externalIp = models.CharField('External-IP', max_length=200)
    current_user = models.CharField('Current_User', max_length=200)
    os = models.CharField('OS', max_length=200)
    admin = models.CharField('Admin', max_length=200)

    def __str__(self):
        return self.hostname


CHOICES = [
    ('Sleep', "Sleep"),
    ('Open SSH_Tunnel', 'Open SSH_Tunnel'),
    ('Close SSH_Tunnel', 'Close SSH_Tunnel'),
    ('Open TCP_Tunnel', 'Open TCP_Tunnel'),
    ('Close TCP_Tunnel', 'Close TCP_Tunnel'),
    ('Open Dynamic', 'Open Dynamic'),
    ('Close Dynamic', 'Close Dynamic'),
    ('Task', 'Task'),
]

class command_node(models.Model):
    host_id = models.ForeignKey(beacon, on_delete=models.CASCADE)
    current_commands = models.CharField(
        choices=CHOICES, max_length=50, null=True)
    previous_commands = models.CharField(
        'previous_commands', max_length=2000, null=True)

    def __str__(self):
        return str(self.host_id)

Code Example Quizzes

Related Code Examples