Cheers bill!

Figured it out already.

However i'm stuck on the database problem which i wrote in a separate email.

Stan
Best Regards,

Stanwin Siow



On Feb 19, 2012, at 9:34 PM, Bill Freeman wrote:

> Yes, you can, as part of the extra context, by whatever name doesn't
> collide.  Then you
> could use it in your template, in a "for" tag.
> 
> You could also pass another one, by a name other than "queryset" at
> the same level as
> the first one, but that becomes an argument to the view, so don't
> expect it to work with
> the generic views, since they don't expect such an argument.  If you
> are writing your
> own view function (or class), you could arrange to accept such an
> argument.  If the
> view is only used with that one url pattern, however, why not just
> specify the queryset
> there?
> 
> Bill
> 
> On Sun, Feb 19, 2012 at 4:07 AM, Alfredo Alessandrini
> <alfredo.ale...@gmail.com> wrote:
>> Hi Stanwn,
>> 
>> try this:
>> 
>> def get_keyword():
>>    return Keyword.objects.all()
>> 
>> UserProfile_info = {
>>     "queryset" : UserProfile.objects.all(),
>>     "extra_context" : {"keyword_list" : get_keyword }
>> }
>> 
>> 
>> Now you can use the variable {{ keyword_list }} to populate the template.
>> 
>> 
>> 
>> Alfredo
>> 
>> 
>> 2012/2/19 Stanwin Siow <stanwin.kts...@gmail.com>
>>> 
>>> Hi Alfredo,
>>> 
>>> My apologies for not making my question clear.
>>> 
>>> I want to pass two different querysets into the url pattern. Is it
>>> possible?
>>> 
>>> Best Regards,
>>> 
>>> Stanwin Siow
>>> 
>>> 
>>> 
>>> On Feb 19, 2012, at 2:01 AM, Alfredo Alessandrini wrote:
>>> 
>>> Hi,
>>> 
>>> I'm not sure that I've understand your question:
>>> 
>>> url(r'^profile/(?P<var_1>\d+)/(?P<var_2>\d+)$', ......)
>>> 
>>> and now you can use the variable var_1 and var_2 in your function.
>>> 
>>> 
>>> Alfredo
>>> 
>>> 
>>> 
>>> 2012/2/18 Stanwin Siow <stanwin.kts...@gmail.com>
>>>> 
>>>> Hello,
>>>> 
>>>> I want to find out if there is anyway to pass two querysets into a url
>>>> pattern.
>>>> 
>>>> i have this url pattern at the moment.
>>>> 
>>>> UserProfile_info = {
>>>>     "queryset" : UserProfile.objects.all(),
>>>>     "extra_context" : {"keyword_list" : Keyword.objects.all}
>>>> }
>>>> 
>>>>     url(r'^profile/$', list_detail.object_list, UserProfile_info),
>>>> 
>>>> 
>>>> I understand from http://www.djangobook.com/en/1.0/chapter09/ that the
>>>> extra_context field is to defind another query set.
>>>> 
>>>> in my Userprofile.html i have the following code:
>>>> 
>>>> {% for userprofile in object_list %}
>>>>    {% if userprofile.username = user.username %}
>>>> 
>>>> that will give me the list of items in userprofile table in the database.
>>>> 
>>>> Is there a way to include the list of items from the keyword table as
>>>> well?
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Best Regards,
>>>> 
>>>> Stanwin Siow
>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> 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.
>>> 
>>> 
>>> 
>> 
>> --
>> 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.
> 
> -- 
> 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.
> 

-- 
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.

Reply via email to