I'm playing with querysets in django.
What I'm looking it's to save a new foreign product or item but I can not achieve it.
shell
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)
What am I doing bad?
I'm trying to create a new product for a client that already exist in db.