Thursday, July 31, 2014

Re: Access to custom fields in view?

On Wednesday, 30 July 2014 19:02:00 UTC+1, Miguel Angel Yáñez Camacho wrote:

in my view in this code i can access to a regular field but i CANT access to custom fields, give me error
            plantillas_db = templates_keyword.objects.select_related('plantilla').filter(keyword=bd_keywordsfinal, plantilla__state='1', plantilla__promocionada=False).distinct().order_by('-plantilla__inserted_date')

            s
= set(plantillas_db)
           
for i in s:
               
print(i.id)
               
print(i.responsive)
               
print(i.engine)

How can i access to this fields?
thanks

Miguel

*What* error you you get *exactly*? The code you've given should be fine, although it's cleaner to use the @property decorator rather than manually wrapping a function (but the functionality is exactly the same). Show us what happens.
--
DR.

--
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+unsubscribe@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.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7a02ccbd-a2b4-4a92-906d-21214bc89016%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment