Re: Search user from Database

2015-03-28 Thread Chenxiong Qi
On Friday, March 27, 2015 at 11:10:19 PM UTC+8, Filipe Ximenes wrote: > > Just checking: when you say you are adding users using > > Group.users.add(user) > ​ > in this case `Group` is an instance of the Group model and NOT the actual > model, correct? > > if so, you can make a query using the s

Re: Search user from Database

2015-03-27 Thread Filipe Ximenes
Just checking: when you say you are adding users using Group.users.add(user) ​ in this case `Group` is an instance of the Group model and NOT the actual model, correct? if so, you can make a query using the same instance, looking for the user: user = Group.user.filter(user).first() if user:

Search user from Database

2015-03-26 Thread nobody
Hi, Sorry for asking a new B question. I have following code in a module.py: class Group(models.Model): .. users = models.ManyToManyField(User, blank=True, null=True) . I can add user or delete user by calling Group.users.add(user) or Group.users.remove(user), but how can I check if t