我正在使用Django Admin创建端口,这是端口模型的方式
class Port(models.Model):
interface = models.CharField(max_length=100)
description = models.CharField(max_length=100)
duplex = models.CharField(max_length=100)
link_status = models.CharField(max_length=100)
protocol_status = models.CharField(max_length=100)
speed = models.CharField(max_length=100)
access_vlan = models.CharField(max_length=100)
native_vlan = models.CharField(max_length=100)
admin_mode = models.CharField(max_length=100)
mode = models.CharField(max_length=100)
switchport = models.CharField(max_length=100)
switchport_negotiation = models.CharField(max_length=100)
trunking_vlans = ArrayField(models.TextField(blank=False), blank=False)
switch = models.ForeignKey(Switch, on_delete=models.CASCADE)
class Meta:
unique_together = (("interface", "switch"),)
def __str__(self):
return f"Interface {self.interface}, description: {self.description}, duplex: {self.duplex}, " \
f"link_status:{self.link_status}, protocol_status: {self.protocol_status}, speed: {self.speed}, " \
f"access_vlan:{self.access_vlan}, native_vlan: {self.native_vlan}, " \
f"trunking_vlans: {self.trunking_vlans}, switch: {self.switch} "
在Django管理员中,当我使用以下命令:https://imgur.com/a/Tw79VDF作为输入时,出现以下错误:
File "/home/dias/ssc-webapp/ssc_django/venv/lib/python3.8/site-packages/django/db/backends/sqlite3/base.py", line 396, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: unrecognized token: ":"
During handling of the above exception, another exception occurred:
...
File "/home/dias/ssc-webapp/ssc_django/venv/lib/python3.8/site-packages/django/db/backends/sqlite3/operations.py", line 141, in _quote_params_for_last_executed_query
return cursor.execute(sql, params).fetchone()
sqlite3.InterfaceError: Error binding parameter 12 - probably unsupported type.