Hi,
You should use User.objects.get(id=X)
Best
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20140926182939.GA26744%40rkade-thinkpad.
> For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL60nj%2BBtqs9CXu8drOiWPoJ7aUkAKjLqXKCxmR_TMTeOOH%3DGw%40mail.gmail.com.
@James Brewer:
If I change my code, I can have this user_ids list.
btw, it's filter and not get if you're searching multiple objects (the
user_ids).
@Alejandro Varas G.:
That doesn't change the fact that 'User.objects.get(id=X)' will hit the
database everytime.
Right now, the problem is solved, by creating the AllUserSet, but I think my
code is pretty ugly, and it seems strange to me that the ORM can't handle that
built-in, by caching the .all() or .filter(id__in=users_ids)
The ideally solution would be something like:
AllUser = User.objects.all()
for i in user_id:
AllUser.get(id=i)