GOT IT!  Thanks to everyone that helped!
I  knew I was close...
I changed my view to this...
        </div>
        {{import random}}
        {{if len(tags) > 0:}}
        <div id="cloud">
            <ul clas<s="nav">
            {{count = 0}}
            {{for tag in relatedTags.keys():}}
                {{size=random.randint(1, 4)}}
                <li>
                    <a class="size{{=size}}" href="view_tag?id=
{{=tag}}" id="j{{=count}}">{{=tagID[tag].name}}</a>
                    <ul style="display: block;" class="hovertip"
target="j{{=count}}">
                    {{count2 = 1}}
                    {{for user in relatedTags[tag]:}}
                        <li><a class="size-sub{{=count2}}"
href="view_user?id={{=user[0].id}}">{{=user[0].first_name}}</a></li>
                        {{count2 += 1}}
                    {{pass}}
                    </ul>
                </li>
                {{count +=1}}
                {{pass}}
            </ul>
        </div>

On Jun 17, 8:56 pm, Jason Brower <[email protected]> wrote:
> I am trying to sort this sql query to give me an output like the
> following...
> TagID
> -Username1
> -username2
> -username3
> TagID2
> -Username2
> -username3
> -username4
>
> This is where I am at now...
> def status():
>     current_user_id=auth.user.id
>     tags = db((db.users.id==db.user_tags.user_id)
>         &(db.user_tags.tag_id==db.tag.id)
>         &(db.user_tags.tag_id.belongs(
>         db(db.user_tags.user_id==current_user_id)._select(
>         db.user_tags.tag_id)))).select(
>         db.users.ALL,db.tag.ALL,groupby=db.users.id)
>     response.title = "Your Profile Page"
>     userForm = SQLFORM(db.users)
>     if userForm.accepts(request.vars):
>         response.flash='User Added!'
>     elif userForm.errors: response.flash='Hmm... Something is wrong
> here...'
>     allTags = db().select(db.tag.ALL,orderby=db.tag.name)
>     relatedTags = {}
>     tagID = {}
>     for tag in tags:
>         if not tag.users.id == auth.user.id:
>             if relatedTags.has_key(tag.tag.id):
>
> relatedTags[tag.tag.id].append(db(db.users.id==tag.users.id).select())
>             else:
>                 relatedTags[tag.tag.id] =
> [db(db.users.id==tag.users.id).select()]
>                 tagID[tag.tag.id] =
> db(db.tag.id==tag.tag.id).select()[0]
>     return dict(tags= tags, userForm = userForm, today=today, user =
> auth.user, allTags = allTags, relatedTags = relatedTags, tagID = tagID)
> ---
>
> But I can't get the wretched thing to print data.
> This is my View...
>         </div>
>         {{import random}}
>         {{if len(tags) > 0:}}
>         <div id="cloud">
>             <ul clas<s="nav">
>             {{count = 0}}
>             {{for tag in relatedTags.keys():}}
>                 {{size=random.randint(1, 4)}}
>                 <li>
>                     <a class="size{{=size}}" href="view_tag?id=Tag name"
> id="j{{=count}}">Tag Name</a>
>                     <ul style="display: block;" class="hovertip"
> target="j{{=count}}">
>                     {{count2 = 1}}
>                     {{for user in relatedTags[tag]:}}
>                         <li><a class="size-sub{{count2}}"
> href="view_user?id=userID"></a>User Name</li>
>                         {{count2 += 1}}
>                     {{pass}}
>                     </ul>
>                 </li>
>                 {{count +=1}}
>                 {{pass}}
>             </ul>
>         </div>
>         {{pass}}
> Have at it ladies and Gents.
> Regards,
> Jason Brower
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to