Re: Django and a basic SQL join

2009-05-06 Thread Clément Nodet

>
> In your case e is a QuerySet, with multiple FlattenedCategory objects.
>
> So the proper code would be to loop through them:
>
> {{{
> for fc in e:
>     fc.category_set
> }}}
>

Indeed,
but category being a ForeignKey field,

{{{
for fc in e:
  fc.category
}}}

will work here.

--
Clément

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: django generic view object_detail problem

2009-05-06 Thread Clément Nodet
Hi,

as mentioned in the tutorial, on generic views (
http://docs.djangoproject.com/en/dev/intro/tutorial04/#use-generic-views-less-code-is-better),
your second template will have the variable 'object' in its context
(not
'object_detail')

So that should work:

{% block content %}
Building
{{ object.name  }}
{% endblock %}

--
Clément

On Wed, May 6, 2009 at 1:13 PM, Waruna de Silva wrote:

> Hi,
> I am bit new to django.
> I am using django generic view to display building details from Building
> module.(Building is model I implemented in my app)
> this is my url patterns
>
> (r'^building/$', list_detail.object_list, building_info),
>  (r'^building/(?P\d+)/$', list_detail.object_detail,
> building_info),
>
> these are the two templates
>
> 1) ---
> {% block content %}
> Buildings 
> {% for building in object_list %}
>   {{ building.name }}
> {% endfor %}
> {% endblock %}
>
> 2)---
> {% block content %}
> Building
> {{object_detail.name}}
> {% endblock %}
>
> first template using objects list display the desired results , but second
> template
> dosent display any results , Wat would the the mistake i may have done. Plz
> any can
> suggest me a soulution.
>
> Thanks in Advance
> Waruna,
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: application profiling

2009-05-05 Thread Clément Nodet

Hi there,

Had that itch a few days ago, found a few nice snippets for in-browser
profiling,
using cProfile :
http://www.djangosnippets.org/snippets/727/
or using hotshots :
http://www.djangosnippets.org/snippets/605/

Also :
http://www.rkblog.rk.edu.pl/w/p/django-profiling-hotshot-and-kcachegrind/

Regards,
--
Clément

On Tue, May 5, 2009 at 1:28 PM, Vance Dubberly  wrote:
>
> Having a hard time trying to figure out how to profile a django
> application. Doesn't seem to be anything built into django itself that
> knows how to report on time spent in methods or sql queries or any
> such thing. Please tell me I'm delusional. Pretty Please?
>
> --
> To pretend, I actually do the thing: I have therefore only pretended to 
> pretend.
>  - Jacques Derrida
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---