#27128: A method model.objects.get(pk=obj.pk) returns many objects, but in a
database is one.
-------------------------------------+-------------------------------------
Reporter: setivolkylany | Owner: nobody
Type: Bug | Status: closed
Component: Uncategorized | Version: 1.9
Severity: Normal | Resolution: needsinfo
Keywords: GenericRelation, | Triage Stage:
Testing, Models | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by setivolkylany):
Replying to [comment:4 timgraham]:
> Yes, we need a project without `factory_boy` to ensure that the problem
isn't in that library.
>
> You can read about [https://github.com/django/django/tree/master/tests
Django's test suite] in our
[https://docs.djangoproject.com/en/dev/internals/contributing/writing-code
/unit-tests/ contributing docs].
After many hours debug my code I found a next problem
{{{
(Pdb) get_user_model().objects.all()
[<User: [email protected]>, <User: othompson@adams-
hess.com>, <User: [email protected]>, <User:
[email protected]>, <User: [email protected]>, <User:
[email protected]>, <User: [email protected]>, <User:
[email protected]>]
(Pdb) get_user_model().objects.all()[0]
<User: [email protected]>
(Pdb) get_user_model().objects.all()[1]
<User: [email protected]>
(Pdb) get_user_model().objects.all()[2]
<User: [email protected]>
(Pdb) get_user_model().objects.all()[3]
<User: [email protected]>
(Pdb) get_user_model().objects.all()[4]
<User: [email protected]>
(Pdb) get_user_model().objects.all()[5]
<User: [email protected]>
}}}
Problem with a user`s model. It on index [0] [1] and [2] return the same
user. It leads to dublication in my replies.
If you know same problem, may be it fixed in the Django 1.10, if not know
- I will still debug.
I wait your response
--
Ticket URL: <https://code.djangoproject.com/ticket/27128#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/071.f3168ac9e1ce9a4bbb24f324f299ede3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.