ContentType and multiple database

45 views
Skip to first unread message

Àlex Pérez

unread,
Aug 1, 2012, 11:27:08 AM8/1/12
to django...@googlegroups.com
Hello, 

I want to take objects of another project that i don't have installed. 
I can have the contenttype of the external object but I can't take the object I understand that, take the object remotly  of a model thah you dosen't have have the class is not possible (I think...) but if i want only a value i think that could be reasonable... 

I want to tho something like that:

 c = ContentType.objects.using("site").get(pk=self.ext_content_id)
 obj = c.get_object_for_this_type(pk=self.ext_object_id).values("nombre")

but obiously doesn't work.

Please guys help me!! 

Thanks


--
Alex Perez
alex....@bebabum.com
 
 bebabum be successful

c/ Còrsega 301-303, Àtic 2
08008 Barcelona
http://www.bebabum.com
http://www.facebook.com/bebabum
http://twitter.com/bebabum

This message is intended exclusively for its addressee and may contain
information that is confidential and protected by professional privilege. 
If you are not the intended recipient you are hereby notified that any 
dissemination, copy or disclosure of this communication is strictly prohibited by law.

Este mensaje se dirige exclusivamente a su destinatario y puede contener
información privilegiada o confidencial. Si no es vd. el destinatario indicado,
queda notificado que la utilización, divulgación y/o copia sin autorización 
está prohibida en virtud de la legislación vigente.

Le informamos que los datos personales que facilite/ha facilitado pasarán a
formar parte de un fichero responsabilidad de bebabum, S.L. y que tiene 
por finalidad gestionar las relaciones con usted. 
Tiene derecho al acceso, rectificación cancelación y oposición en nuestra
oficina ubicada en c/ Còrsega 301-303, Àtic 2 de Barcelona o a la dirección de e-mail lo...@bebabum.com

Melvyn Sopacua

unread,
Aug 2, 2012, 5:15:17 PM8/2/12
to django...@googlegroups.com
On 1-8-2012 17:27, �lex P�rez wrote:
> Hello,
>
> I want to take objects of another project that i don't have installed.
> I can have the contenttype of the external object but I can't take the
> object I understand that, take the object remotly of a model thah you
> dosen't have have the class is not possible (I think...) but if i want only
> a value i think that could be reasonable...
>
> I want to tho something like that:
>
> c = ContentType.objects.using("site").get(pk=self.ext_content_id)
> obj = c.get_object_for_this_type(pk=self.ext_object_id).values("nombre")

Rather then fighting the project separation, the easiest solution by far
is to make the data available by webrequest in a format you can read,
like json or XML and use python's httplib to fetch it.

--
Melvyn Sopacua
Reply all
Reply to author
Forward
0 new messages