• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

allegro / ralph / 7891
85%

Build:
DEFAULT BRANCH: ng
Ran 26 Apr 2017 10:33AM UTC
Jobs 1
Files 230
Run time 20s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
7891

push

travis-ci

web-flow
Handle m2m prefetching in polymorphic (#3035)

To properly handle m2m prefetching of polymorphic objects (ex. `Operation.objects.prefetch_related(Prefetch(BaseObject.polymorphic_objects.all()))`), the following steps had to be added to polymorphic iterator:
* copying extra fields from base queryset
* copying filters from base queryset, to properly handle joins - this could be optimized in the future to not add unnecessary `WHERE` statements to SQL query.

* Fix `polymorphic_objects` in prefetch related, when base model is filtered

Based on example with Operation and BaseObject: it happened,
that when Operation objects were filtered, `polymorphic_filter`
still contains `Operation.objects.all()`, so all BaseObjects with
particular id(s) which have corresponding Operation (any! not only
the ones filtered in base query) were fetched from DB - but (here
comes the magic!) we were iteration through PKs of objects (BaseObject)
from original query and yield them in the same amount as they occur in
original query (so if there were 3 BaseObjects with PK 1234 in
original query, a lot more objects could be fetched, but only 3
of them were returned, and they might not correspond to current query
of base model (Operation)).

Right now, every fetched object is returned.

24 of 24 new or added lines in 1 file covered. (100.0%)

12247 of 14441 relevant lines covered (84.81%)

0.85 hits per line

Jobs
ID Job ID Ran Files Coverage
3 7891.3 (DJANGO_VERSION=1.8.18 TEST_DB_ENGINE=psql) 26 Apr 2017 10:33AM UTC 0
84.81
Travis Job 7891.3
Source Files on build 7891
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #7891
  • 756663a8 on github
  • Prev Build on ng (#7883)
  • Next Build on ng (#7892)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc