Whoops, missed the map step. I think you will need to create a new dict using the try/except above, and then map the new dict to str
On Monday, September 23, 2013 5:29:40 PM UTC-5, C. Kirby wrote: > > try: > value = getattr(object, 'get_%s_display' % field)() > except: > value getattr(object, field) > > On Monday, September 23, 2013 4:47:33 PM UTC-5, Lachlan Musicman wrote: >> >> Ok, so here's the challenging part - how would you get the >> get_FOO_display value for some but not all of those values? >> >> cheers >> L. >> >> On 23 September 2013 23:29, Valder Gallo <valde...@gmail.com> wrote: >> > :D >> > >> > >> > >> > On Mon, Sep 23, 2013 at 10:12 AM, Lachlan Musicman <dat...@gmail.com> >> > wrote: >> >> >> >> On 23 September 2013 22:47, Valder Gallo <valde...@gmail.com> wrote: >> >> > Sorry, i really donĀ“t understand why you need this. >> >> >> >> To mail merge details taken in web app into a report. >> >> >> >> > If you just wanna convert one object in a list string. >> >> > >> >> > map(str, object.__dict__.values()) >> >> >> >> Thanks! Very succinct. >> >> >> >> L. >> >> >> >> >> >> >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > On Mon, Sep 23, 2013 at 2:56 AM, Lachlan Musicman <dat...@gmail.com> >> >> >> > wrote: >> >> >> >> >> >> Hola, >> >> >> >> >> >> I'm using a standard view function to retrieve all details about an >> >> >> object: >> >> >> >> >> >> header =[] >> >> >> headers = object._meta.get_all_field_names() >> >> >> row = [] >> >> >> for field in headers: >> >> >> value = getattr(object, field) >> >> >> row.append(value) >> >> >> >> >> >> to collect info on a particular object passed to a view. >> >> >> >> >> >> I was wondering how I might exclude the unicode markings on a test >> >> >> field (eg: u'text' ) from the output? IE, get rid of all the >> leading >> >> >> u's. I could just strip/slice but I presume there is a less clunky >> >> >> way? >> >> >> >> >> >> cheers >> >> >> L. >> >> >> >> >> >> -- >> >> >> Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013: >> >> >> When you used to be punk, and now you are still punk but not as >> punk, >> >> >> are you post-punk or decaying punk or ex-punk or just not punk >> anymore >> >> >> >> >> >> -- >> >> >> 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. >> >> >> To post to this group, send email to django...@googlegroups.com. >> >> >> Visit this group at http://groups.google.com/group/django-users. >> >> >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > >> >> > >> >> > >> >> > >> >> > -- >> >> > Valder Gallo >> >> > +55 11 9949 2911 >> >> > +55 11 2532 2911 >> >> > Skype: valdergallo >> >> > @valdergallo >> >> > www.valdergallo.com.br >> >> > >> >> > -- >> >> > 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. >> >> > To post to this group, send email to django...@googlegroups.com. >> >> > Visit this group at http://groups.google.com/group/django-users. >> >> > For more options, visit https://groups.google.com/groups/opt_out. >> >> >> >> >> >> >> >> -- >> >> Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013: >> >> When you used to be punk, and now you are still punk but not as punk, >> >> are you post-punk or decaying punk or ex-punk or just not punk anymore >> >> >> >> -- >> >> 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. >> >> To post to this group, send email to django...@googlegroups.com. >> >> Visit this group at http://groups.google.com/group/django-users. >> >> For more options, visit https://groups.google.com/groups/opt_out. >> > >> > >> > >> > >> > -- >> > Valder Gallo >> > +55 11 9949 2911 >> > +55 11 2532 2911 >> > Skype: valdergallo >> > @valdergallo >> > www.valdergallo.com.br >> > >> > -- >> > 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. >> > To post to this group, send email to django...@googlegroups.com. >> > Visit this group at http://groups.google.com/group/django-users. >> > For more options, visit https://groups.google.com/groups/opt_out. >> >> >> >> -- >> Maya Otos (@maya_otos) tweeted at 9:27 PM on Tue, Jul 30, 2013: >> When you used to be punk, and now you are still punk but not as punk, >> are you post-punk or decaying punk or ex-punk or just not punk anymore >> > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.