Error After Inspect db

18 views
Skip to first unread message

mansi thakkar

unread,
Mar 13, 2018, 11:58:57 AM3/13/18
to Django users
Hello , 
Here is the attached files of my output and my error and my models.py file. I have database residing in aws cloud platform. What I have done is I have used inspectdb command and created models using that command. Then have registered my model into admin site and then model has been displayed (Ingredient in my case.) Now it is showing Ingredient object for each and every entry as shown in pic I would like to display master_name instead og ingredient_name. How can I do that? 
Please reply me as soon as possible. 
Thank you.
DjangoError.png
IngredientError.png
models.png

Avraham Serour

unread,
Mar 13, 2018, 12:09:36 PM3/13/18
to django-users
it seems you wrote def_str_, if should be def (space) then the function name

also the function str should probably be named with double underscores like this: __str__ not _str_

--
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...@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/d9fe676d-9988-4f59-a97f-fdc5db777e39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mansi thakkar

unread,
Mar 13, 2018, 1:26:15 PM3/13/18
to Django users
I got it and tried as you said but still couldn't get the output as I want. It is still showing ingredient object.


On Tuesday, March 13, 2018 at 12:09:36 PM UTC-4, Avraham Serour wrote:
it seems you wrote def_str_, if should be def (space) then the function name

also the function str should probably be named with double underscores like this: __str__ not _str_
On Tue, Mar 13, 2018 at 5:27 PM, mansi thakkar <mansith...@gmail.com> wrote:
Hello , 
Here is the attached files of my output and my error and my models.py file. I have database residing in aws cloud platform. What I have done is I have used inspectdb command and created models using that command. Then have registered my model into admin site and then model has been displayed (Ingredient in my case.) Now it is showing Ingredient object for each and every entry as shown in pic I would like to display master_name instead og ingredient_name. How can I do that? 
Please reply me as soon as possible. 
Thank you.

--
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.
Reply all
Reply to author
Forward
0 new messages