Re: Slicing on queryset not working when using .last() after queryset

2018-09-24 Thread SHIVAM JINDAL
).order_by('id')[:5].values('id') > > > >>> News.objects.all().order_by('id')[:5][4].id > 5 > > >>> #But calling 'last' gives us wrong id: > >>> News.objects.all().order_by('id')[:5].last() > 11 > > > п

Slicing on queryset not working when using .last() after queryset

2018-09-24 Thread SHIVAM JINDAL
: 4L}, {'id': 5L}] >>> Pharmaceutical.objects.order_by('id')[:2].values('id') [{'id': 2L}, {'id': 3L}] >>> Pharmaceutical.objects.order_by('id')[:2].values('id').last() {'id': 5L} # But this shou

Re: OneToOneField not updating relationship with reverse relation after refresh_from_db()

2018-09-04 Thread Shivam Jindal
is expected to only update the current model, > not traverse to others linking it (which could be *many*). You'd want > m.refresh_from_db() to refresh the fact that the user field on m has > changed. > > On Sun, 2 Sep 2018 at 20:40, Ian Foote wrote: > >> On 02/09/18 19:

Re: OneToOneField not updating relationship with reverse relation after refresh_from_db()

2018-09-02 Thread Shivam Jindal
Hi Lan, *m.user.refresh_from_db()* is sam as *u = m.user* *u.refresh_from_db()* So If I am refreshing u, it should update all relationship and property of *u*(including reverse relation). Should It not? On Mon, Sep 3, 2018 at 12:24 AM, Ian Foote wrote: > On 02/09/18 17:58, Shivam Jin

OneToOneField not updating relationship with reverse relation after refresh_from_db()

2018-09-02 Thread Shivam Jindal
*refresh_from_db()* -- *Shivam Jindal* *Software Developer* | *Josh Technology Group* shivam.jin...@joshtechnololygroup.com -- CONFIDENTIALITY NOTICE: The information contained in this e-mail is for the intended recipient(s) alone. It may contain privileged and confidential information that is