-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi,
I'm using version 0.91. To put it short, I get a TypeError when I try to use a foreign key. Here's what I have: _In Postgresql_ TABLE "cadastro_servicos" ( ~ "id" serial NOT NULL PRIMARY KEY, ~ "codigo" text NOT NULL, ~ "nome" varchar(80) NOT NULL ); TABLE "cadastro_cadastros" ( ~ "id" serial NOT NULL PRIMARY KEY, ~ "serv_clientes_id" integer NOT NULL REFERENCES "cadastro_servicos" ("id"), ~ "nome" varchar(200) NOT NULL, ~ (...) ); INSERT INTO "packages" ("label", "name") VALUES ('cadastro', 'cadastro'); INSERT INTO "content_types" ("name", "package", "python_module_name") VALUES ('servico', 'cadastro', 'servicos'); INSERT INTO "content_types" ("name", "package", "python_module_name") VALUES ('cadastro', 'cadastro', 'cadastros'); As _django models_: class Servico(meta.Model): ~ codigo = meta.TextField(maxlength=4) ~ nome = meta.CharField(maxlength=80) ~ def __repr__(self): ~ return self.nome class Cadastro(meta.Model): ~ serv_clientes = meta.ForeignKey(Servico) ~ nome = meta.CharField(maxlength=200) ~ (...) ~ def __repr__(self): ~ return self.nome when I try: lista_sps = cadastros.get_list(servicos__id__exact=2) from within a view, I get: TypeError at /cadastro/pesquisa/ got unexpected keyword argument 'servicos__id__exact' The same happens from the interactive shell. |>> cadastros.get_list(servico__nome__icontains='bel') |>> cadastros.get_object(servico__nome__icontains='bel') |>> cadastros.get_object(codigo__icontains='bel') I've also tried, just in case: |>> cadastros.get_object(Servico__nome__icontains='bel') |>> cadastros.get_object(Servicos__nome__icontains='bel') If I try to get a list or a object from either of the two classes alone (with no references to the other) I have no problems getting the information I want. How did I build this? First I've developed the Cadastro model, and did 'python manage.py install cadastro'. At this time, cadastro had no serv_clientes field. Later on, I added the Servico class to the model, added the table to Postgresql and changed the Cadastro model to include the serv_clientes field. Everything seems alright for me, but not for django. Why does 'got unexpected keyword argument' happen? Can you give me some hints? Luis -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFEUmG4Hn4UHCY8rB8RAhCyAJoCzUTmRlf52kDubk4t5qVYhynJjQCeMoqi sx0jE2ZESvUYozVrYxAMg0c= =npYm -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---