Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Remote auto_publish field from Publisher #3424

Merged
merged 1 commit into from Apr 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 2 additions & 7 deletions pulpcore/pulpcore/app/models/repository.py
Expand Up @@ -145,8 +145,6 @@ class Publisher(MasterModel):

Fields:

auto_publish (models.BooleanField): Indicates that the adaptor may publish automatically
when the associated repository's content has changed.
last_published (models.DatetimeField): When the last successful publish occurred.

Relations:
Expand All @@ -155,8 +153,6 @@ class Publisher(MasterModel):
TYPE = 'publisher'

name = models.TextField(db_index=True, unique=True)

auto_publish = models.BooleanField(default=True)
last_published = models.DateTimeField(blank=True, null=True)

class Meta:
Expand All @@ -169,16 +165,15 @@ class Exporter(MasterModel):

Fields:

name (models.CharField): The exporter unique name.
last_updated (models.DatetimeField): Timestamp of the last update.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defined on the Master model, not here.

name (models.TextField): The exporter unique name.
last_export (models.DatetimeField): When the last successful export occurred.

Relations:

"""
TYPE = 'exporter'

name = models.CharField(max_length=255, db_index=True, unique=True)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a TextField like all the others.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...or maybe all the names should be CharField, instead. TextField is really meant for long blobs of text, CharField for short ones that need to be size-bounded.

We just need to be consistent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we know the max length of all strings, so that change would be pretty big. https://docs.pulpproject.org/en/3.0/nightly/contributing/3.0-development/data-modeling.html?highlight=textfield#introduction

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1.

name = models.TextField(db_index=True, unique=True)
last_export = models.DateTimeField(blank=True, null=True)

class Meta:
Expand Down
7 changes: 1 addition & 6 deletions pulpcore/pulpcore/app/serializers/repository.py
Expand Up @@ -146,11 +146,6 @@ class PublisherSerializer(MasterModelSerializer):
help_text=_('Timestamp of the most recent update of the publisher configuration.'),
read_only=True
)
auto_publish = serializers.BooleanField(
help_text=_('An indication that the automatic publish may happen when'
' the repository content has changed.'),
required=False
)
last_published = serializers.DateTimeField(
help_text=_('Timestamp of the most recent successful publish.'),
read_only=True
Expand All @@ -165,7 +160,7 @@ class Meta:
abstract = True
model = models.Publisher
fields = MasterModelSerializer.Meta.fields + (
'name', 'last_updated', 'auto_publish', 'last_published', 'distributions',
'name', 'last_updated', 'last_published', 'distributions',
)


Expand Down