Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with getting versions #54

Open
jonathan-s opened this issue Jan 27, 2020 · 0 comments
Open

Issues with getting versions #54

jonathan-s opened this issue Jan 27, 2020 · 0 comments

Comments

@jonathan-s
Copy link
Contributor

jonathan-s commented Jan 27, 2020

Getting the versions of an image correctly seems to generate the following query. I tried this on an image that was only in draft mode. When you query image.versions.all() you should be getting a single version.

# image.versions.all().query, this is an empty queryset

SELECT "djangocms_versioning_version"."id", "djangocms_versioning_version"."created",
"djangocms_versioning_version"."modified", "djangocms_versioning_version"."created_by_id",
"djangocms_versioning_version"."number", "djangocms_versioning_version"."content_type_id",
"djangocms_versioning_version"."object_id", "djangocms_versioning_version"."state",
"djangocms_versioning_version"."source_id" FROM "djangocms_versioning_version" 
WHERE ("djangocms_versioning_version"."content_type_id" = 48 
AND "djangocms_versioning_version"."object_id" = 5419)

If you get it through the grouper it will give the following query instead. It gave back one result as expected.

Version.objects.filter_by_grouper(image.grouper).query

SELECT "djangocms_versioning_version"."id", "djangocms_versioning_version"."created",
"djangocms_versioning_version"."modified", "djangocms_versioning_version"."created_by_id",
"djangocms_versioning_version"."number", "djangocms_versioning_version"."content_type_id",
"djangocms_versioning_version"."object_id", "djangocms_versioning_version"."state",
"djangocms_versioning_version"."source_id" FROM "djangocms_versioning_version" 
WHERE ("djangocms_versioning_version"."object_id" 
IN (SELECT U0."id" AS Col1 FROM "filer_file" U0 WHERE U0."grouper_id" = 4714) 
AND "djangocms_versioning_version"."content_type_id" IN (48, 45, 326)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant