pombreda / django-grappelli

Automatically exported from code.google.com/p/django-grappelli
Other
0 stars 0 forks source link

Don't show table header on tabular inline template if extra=0 #360

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Which DJANGO-VERSION are you using?

Django 1.3

Which GRAPPELLI-VERSION are you using?

Current svn trunk

What steps will reproduce the problem?
1. Create a model admin with an tabular inline
2. set extra=0 on that tabular inline

What is the expected output? What do you see instead?

Expected would be Only the table header (model name) and in the table body the 
"add ..." link.  Instead the whole table including table-heads (th) are 
rendered and as there are no rows and the column heads are rendered it looks a 
bit ugly.

I just attached a proper svn diff to fix this.

Original issue reported on code.google.com by cgr...@gmail.com on 29 Mar 2011 at 12:24

Attachments:

GoogleCodeExporter commented 9 years ago
with the fix you´r suggesting, the table header is missing if I click on "add 
..." ... right?

Original comment by sehmaschine on 29 Mar 2011 at 12:27

GoogleCodeExporter commented 9 years ago
Just reviewed my own change... sorry for the spam but the Change should be 
this: http://paste.pocoo.org/show/etpLB4EIoe9aY5k9f1CV/

This is much more reliable or... at least works ;)

Original comment by cgr...@gmail.com on 29 Mar 2011 at 2:18

GoogleCodeExporter commented 9 years ago
But yea, you're wrong.  I'm suggesting that the table header is missing if 
there are no extra forms visible.

Original comment by cgr...@gmail.com on 29 Mar 2011 at 2:19

GoogleCodeExporter commented 9 years ago
I still don´t get it. the table-header is not visible if there are no 
extra-forms. but if I click the add-button the table-header should be there 
(but how do I get the header if it´s not in the template ...).

Original comment by sehmaschine on 29 Mar 2011 at 2:23

GoogleCodeExporter commented 9 years ago
That's why I created a new patch, just for convenience, I attached it again.

Original comment by cgr...@gmail.com on 29 Mar 2011 at 2:38

Attachments:

GoogleCodeExporter commented 9 years ago
looks better ... thanks.

Original comment by sehmaschine on 29 Mar 2011 at 2:45

GoogleCodeExporter commented 9 years ago
unfortunately, the patch doesn´t completely work:
if you set extra=0, then add an inline-row, add an error somewhere within your 
form (e.g. remove a required-field), then save ... the table-header is not 
there.

that´s one of the things we´re very careful about: the form needs to be 
preserved in case of errors. not sure if this can be solved since the added 
inline-row is there, but extra is still "0".

I´d like to remove the table-header as well (if there are no inline-forms). 
that being said, the error-case is more important to me.

Original comment by sehmaschine on 8 Apr 2011 at 7:09