Skip to content

Commit

Permalink
Exclude pulp fields for QueryModelResources
Browse files Browse the repository at this point in the history
This saves plugin writers from having to define exclude on any of their
resources that extend QueryModelResources.

fixes #7277
  • Loading branch information
David Davis authored and daviddavis committed Aug 5, 2020
1 parent 63cdccd commit 55641fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGES/plugin_api/7277.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Automatically excluding ``pulp_id``, ``pulp_created``, and ``pulp_last_updated`` for
``QueryModelResources``.
12 changes: 4 additions & 8 deletions pulpcore/plugin/importexport.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def __init__(self, repo_version=None):
if repo_version:
self.queryset = self.set_up_queryset()

class Meta:
exclude = ("pulp_id", "pulp_created", "pulp_last_updated")


class BaseContentResource(QueryModelResource):
"""
Expand All @@ -38,14 +41,7 @@ class BaseContentResource(QueryModelResource):
"""

class Meta:
exclude = (
"_artifacts",
"content",
"content_ptr",
"pulp_id",
"pulp_created",
"pulp_last_updated",
)
exclude = QueryModelResource.Meta.exclude + ("_artifacts", "content", "content_ptr")

def dehydrate_upstream_id(self, content):
return str(content.pulp_id)

0 comments on commit 55641fe

Please sign in to comment.