[BangPypers] 'dict' object has no attribute 'company_name'

ashok raavi ashok.raavi at gmail.com
Mon Aug 15 11:39:19 CEST 2011


On Mon, Aug 15, 2011 at 3:03 PM, Ramdas S <ramdaz at gmail.com> wrote:

> On Mon, Aug 15, 2011 at 3:00 PM, Asif Jamadar <asif.jamadar at rezayat.net
> >wrote:
>
> > charges = [(c.company_name)
> >
> >                 for c in
> > ReportModel.objects.values('company_name').distinct()]
>

.values returns a QuerySet that returns dictionaries when used as an
iterable, rather than model-instance objects.

https://docs.djangoproject.com/en/dev/ref/models/querysets/#values


> >
> >
> > but it throws this error: " 'dict' object has no attribute
> 'company_name'"
> >
> >
> > paste the whole code somewhere may be dpaste.com and ask the question
>
> >
> > any suggestions?
> > _______________________________________________
> > BangPypers mailing list
> > BangPypers at python.org
> > http://mail.python.org/mailman/listinfo/bangpypers
> >
>
>
>
> --
> Ramdas S
> +91 9342 583 065
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>



-- 
ashok raavi


More information about the BangPypers mailing list