Skip to content
This repository has been archived by the owner on Oct 28, 2019. It is now read-only.

Commit

Permalink
Add content-guard to Distribution.
Browse files Browse the repository at this point in the history
closes #3970
  • Loading branch information
jortel committed Oct 1, 2018
1 parent 8276aea commit 154eea2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pulpcore/pulpcore/app/models/publication.py
Expand Up @@ -202,6 +202,7 @@ class BaseDistribution(Model):
publication (models.ForeignKey): The current publication associated with
the distribution. This is the publication being served by Pulp through
this relative URL path and settings.
content_guard ((models.ForeignKey): An optional content-guard.
"""

name = models.CharField(max_length=255, db_index=True, unique=True)
Expand All @@ -210,6 +211,7 @@ class BaseDistribution(Model):
publication = models.ForeignKey(Publication, null=True, on_delete=models.SET_NULL)
publisher = models.ForeignKey(Publisher, null=True, on_delete=models.SET_NULL)
repository = models.ForeignKey(Repository, null=True, on_delete=models.SET_NULL)
content_guard = models.ForeignKey('ContentGuard', null=True, on_delete=models.SET_NULL)

class Meta:
abstract = True
Expand Down
14 changes: 13 additions & 1 deletion pulpcore/pulpcore/app/serializers/repository.py
Expand Up @@ -278,6 +278,12 @@ class DistributionSerializer(ModelSerializer):
queryset=models.Publisher.objects.all(),
allow_null=True
)
content_guard = DetailRelatedField(
required=False,
help_text=_('An optional content-guard.'),
queryset=models.ContentGuard.objects.all(),
allow_null=True
)
publication = RelatedField(
required=False,
help_text=_('The publication being served as defined by this distribution'),
Expand All @@ -301,7 +307,13 @@ class DistributionSerializer(ModelSerializer):
class Meta:
model = models.Distribution
fields = ModelSerializer.Meta.fields + (
'name', 'base_path', 'publisher', 'publication', 'base_url', 'repository',
'name',
'base_path',
'publisher',
'publication',
'base_url',
'repository',
'content_guard',
)

def _validate_path_overlap(self, path):
Expand Down

0 comments on commit 154eea2

Please sign in to comment.