Try looking here, some good information I think http://stackoverflow.com/questions/2170228/django-iterate-over-model-instance-field-names-and-values-in-template
On Sat, Mar 31, 2012 at 10:15 AM, Thomas <[email protected]> wrote: > Sorry I wasn't being too clear. I would like to use the name of the field > (just with the first letter capitalized) as a label. e.g. the field named > 'email' would be labeled 'Email'. I just don't know how to do that. > > > On Saturday, March 31, 2012 3:13:56 PM UTC+2, BoulderDave wrote: >> >> Well, if contact, email, and phone were some sort of relationship instead >> of just a charfield/email field, you could loop through them (lets say they >> were a many2many to 'field'), and have a label (maybe help_text) associated >> with each field... but thats making it more complicated then it needs to >> be... it isn't breaking the DRY principle really.. these are each a unique >> field that need to be handled individually.. your not hardcoding them.. >> that's like saying you hardcoded the code of your application because code >> was written. >> >> Dave >> >> On Sat, Mar 31, 2012 at 8:51 AM, Thomas <[email protected]> wrote: >> >>> I am convinced that there must be a way to this in a loop in the >>> template: >>> >>> <table class="indented"> >>> <tr><td>Contact :</td><td>{{ product.extendedproductfields.**contact >>> }}</td></tr> >>> <tr><td>Email : </td><td>{{ product.extendedproductfields.**email >>> }}</td></tr> >>> <tr><td>Phone : </td><td>{{ product.extendedproductfields.**phone >>> }}</td></tr> >>> </table> >>> >>> How can I print the 'Email', 'Phone', .. fields automatically in the >>> table above rather than hard-code them? >>> >>> Many thanks, >>> Thomas >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Satchmo users" group. >>> To view this discussion on the web visit https://groups.google.com/d/** >>> msg/satchmo-users/-/**TF5dAJEINYIJ<https://groups.google.com/d/msg/satchmo-users/-/TF5dAJEINYIJ> >>> . >>> To post to this group, send email to [email protected]**. >>> To unsubscribe from this group, send email to satchmo-users+unsubscribe@ >>> **googlegroups.com <satchmo-users%[email protected]>. >>> For more options, visit this group at http://groups.google.com/** >>> group/satchmo-users?hl=en<http://groups.google.com/group/satchmo-users?hl=en> >>> . >>> >> >> >> >> -- >> Dave Brown >> CEO/Founder >> Rampframe.com - Action Sports Network >> > -- > You received this message because you are subscribed to the Google Groups > "Satchmo users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/satchmo-users/-/cHv4t0ka3LgJ. > > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/satchmo-users?hl=en. > -- Dave Brown CEO/Founder Rampframe.com - Action Sports Network -- You received this message because you are subscribed to the Google Groups "Satchmo users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/satchmo-users?hl=en.
