cccs-web / core

CCCS' customized django web application
4 stars 11 forks source link

field with no data showing as empty #161

Closed cccs-ip closed 9 years ago

cccs-ip commented 9 years ago

We discussed at some point about whether it were possible to have data fields not show where there is no information. Currently in the CV page (supplied from cv_detail ) the 'references' section under 'projects' is still showing up--in spite of there being no data supplied in that field. Can we make it so that all fields are hidden if no data is supplied to them?

screenshot from 2014-09-21 22 07 19

pwhipp commented 9 years ago

Strictly speaking, this is what the templates do by default already. Unfortunately, this behavior does not extend to the table headings and styling we put around the field so we end up with a table entry and no value being displayed.

I've gone through the template and added the additional code to only display these elements when the field has a value in it. It was already a significant portion of the way there.

Given the resulting complexity of the template logic, I've broken it into a collection of included templates. This has the disadvantage of splitting the presentation over a number of files but it has the advantage of making the structure easier to understand and work with. Let me know if you find it beneficial.

cccs-ip commented 9 years ago

Cool, and thank you! This will help me to learn. I am typing notes from a Jakarta call I was just on ATM but it would be good to schedule some specific tutorial sessions in the near future.

cccs-ip commented 9 years ago

Once I can see how you achieve this, I'll try to apply it elsewhere. I essentially wish to hide missing fields whenever they occur:

screenshot from 2014-09-23 00 06 04