Hi there,
I've looked for some clue on this group but nothing similar for my
case.
I've got the following models:
class Service:
name =
...
class TimeTable:
...
class UserService:
user = ForeignKey(User)
service = ForeignKey(Service)
timetable = ForeignKey(TimeTable)
I've tried to get list of service that aren't used by selected user, in
this way:
cursor.execute("SELECT sms_service.name FROM sms_service WHERE
sms_service.id NOT IN (SELECT sms_userservices.service_id FROM
sms_userservices WHERE sms_userservices.user_id = 9)"),
it's in dirty sql. I was trying use filter and exclude, but didn't get
correct results.
Service.objects.exclude(userservices__user__id=9)
return empty list, I'm sure that I've some service that aren't used by
this user. I don't know
why that didn't work for me, so could sombody show me how to rewrite
this piece of sql code into django right way?
Greets,
Jakub
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---