Thanks for your answer. I have one more question. What if there are more than one primary keys in that table? I'm talking about the unique_together case.
27 Kasım 2017 Pazartesi 08:55:45 UTC+3 tarihinde Matemática A3K yazdı: > > What Django shows in that dropdown is the __str__() method of the object, > define it to your needs in A :) > > On Sun, Nov 26, 2017 at 7:49 PM, Kubilay Yazoğlu <[email protected] > <javascript:>> wrote: > >> Hello. I have two models. In one of them, I declared a foreign key to the >> other one. Since this is done in Django by only specifying the Class name, >> without specifying the field name(column name), when I try to create an >> object in admin panel, it pulls the wrong column information. >> >> Two models A and B. >> B has a Foreignkey for accessing A. >> A has two fields Field1 and Field2. >> When I try to create an instance of B, in the field of Foreignkey, there >> is a drop down menu but the content is not from the right field of A. >> >> How to specify it? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/ad0d40a3-cd7f-4f2f-821d-31cc007657b1%40googlegroups.com >> >> <https://groups.google.com/d/msgid/django-users/ad0d40a3-cd7f-4f2f-821d-31cc007657b1%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/60af36a5-7fec-46f7-a348-ae4a8784f01b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

