私はdjangoでquerysetsで遊んでいます。Python Django Queryset
私が探しているのは、新しい外国製品やアイテムを保存することですが、達成できません。
シェル
from applaboratorio.models import Datos_empresa_DB, Datos_equipo_DB
detalle = Datos_empresa_DB.objects.filter(pk=58)
resp = Datos_equipo_DB(equipo='dell-labtop',marca='dell', modelo='432423',Foraneo_Datos_empresa_DB = detalle)
models.py
class Datos_empresa_DB(models.Model):
nombre = models.CharField(max_length=150)
empresa = models.CharField(max_length=150)
class Datos_equipo_DB(models.Model):
Foraneo_Datos_empresa_DB = models.ForeignKey(Datos_empresa_DB)
equipo = models.CharField(max_length=300)
marca = models.CharField(max_length=300)
modelo = models.CharField(max_length=300)
私は悪い何をしているのですか?
私はすでにdbに存在するクライアント用の新しい製品を作成しようとしています。
テーブルの形状がわかるようにモデル定義を含める必要があります。 – McAbra