Saturday, March 24, 2018

Re: How to undisplay the field with empty value in django admin?


Grammarly messed up my post quite badly...

You should set the extra attribute to 0 (so only if there is data admin will display an entry. If you set it to 6 it will display 6 empty entries but that's what you wanted to prevent)

In your admin.py you have to create an InlineAdmin for StoichiometryMetabolite:

class StoichiometryMetaboliteInline(admin.StackedInline):
model = StoichiometryMetabolite
extra = 0

also the ending ] was missing

 inlines = [StoichiometryMetaboliteInline]





--
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/ca584dd7-3525-47db-bacb-042b72f5334b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment