Friday, November 15, 2019

Re: How to change how foreign keys are view in admin site

after that model write like this
def __str__(self):
      return self.title

On Fri, Nov 15, 2019 at 6:18 PM Usman Hassan <usmanhassangu@gmail.com> wrote:
I have a problem with my django app, I created a an that has two models one which is post and the other is comment, and the comment has a foreign key relationship to post. But anytime I view the admin site and I tried to relate a comment to a post I made, it won't show me the title of the post but instead it will show 'post object (1)'. Pls I there any way I can change that???

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c92d6f0a-b50f-4d7a-adf8-fd0e3b04a801%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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMtmBS9LiH7F9D_T0DRNT8-eNJNzGs6rmfxMJOuyqkoCb%3DsHEw%40mail.gmail.com.

No comments:

Post a Comment