On Mon, Nov 27, 2017 at 10:50 AM, Kubilay Yazoğlu <kyazogluu@gmail.com> wrote:
Thanks for your answer. I have one more question. What if there are more than one primary keys in that table?
By definition, that won't happen, a primary key is unique. If you add a record with the same key Django will raise an IntegrityError.
I'm talking about the unique_together case.
I don't understand you
--
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 <kyaz...@gmail.com> 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 django-users...@googlegroups.com .
To post to this group, send email to django...@googlegroups.com.
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%40goog legroups.com
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 django-users+unsubscribe@googlegroups.com .
To post to this group, send email to django-users@googlegroups.com.
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
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
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/CA%2BFDnhJYq2rsw9BPGVhTSSBsr%2BLnn_DwffbUP4XM0Twon6fy8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment