Okay.. solved my issue... but ran into another one.

Rows are returned - however output is returned with no Keys

looks like this  [(4, 2, 'ACT', 3, 'Chris', 'Yiu'), (2, 2, 'ADM', 1,
'Robert', 'Chan')]

Anyone have any thoughts on how to get the keys?

On May 21, 11:35 am, Roboto <[EMAIL PROTECTED]> wrote:
> Thanks,
>
> Yes this was true indeed!
>
> In any event, I've had to resort to using a custom SQL statement to
> solve my issue.  Although, I know the query works (tested in psql),
> and nothing is crashing, but I'm not getting any output from the
> system... it's quite odd actually... I don't know why just yet.
>
> def view_roster(request,id):
>     t = loader.get_template('team/roster.html')
>     team_profile = Team.objects.get(id=id)
>     if request.user.is_authenticated():
>         logged_in = True
>         roster = my_custom_sql(id)
>     else:
>         logged_in = False
>         roster = False
>     c = Context({
>         'roster':roster,
>         'logged_in':logged_in,
>         'team':team_profile,
>     })
>     return HttpResponse(t.render(c))
>
> def my_custom_sql(team_id):
>     from django.db import connection
>     cursor = connection.cursor()
>     cursor.execute("SELECT
> a.id,a.team_id,status,a.user_id,first_name,last_name FROM login_access
> AS a INNER JOIN login_personal AS b ON (a.user_id = b.user_id) WHERE
> (a.team_id = %s AND (NOT (a.status = 'NON' OR a.status = 'WAT')))",
> [team_id])
>     row = cursor.fetchall()
>     return row
>
> On May 21, 12:42 am, Kelvin Nicholson <[EMAIL PROTECTED]> wrote:
>
> > Roboto wrote:
> > > Tables exist =P
>
> > Yay.
>
> > > Here is where I am at now.. and my error
>
> > [snip]
>
> > > TypeError: iteration over non-sequence
>
> > This likely means your user_list is empty, I think.  So, double check
> > that your first filter (putting the objects into user_list) actually
> > returns objects.
>
> > My .02
>
> > Kelvin
>
> > --
> > Kelvin Nicholson
> > Voice: +886 9 52152 336
> > Voice: +1 503 715 5535
> > GPG Keyid: 27449C8C
> > Data: [EMAIL PROTECTED]
> > Skype: yj_kelvin
> > Site:http://www.kelvinism.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to