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

Fields: created & last_updated moved to Model. #3325

Merged
merged 1 commit into from Feb 14, 2018
Merged

Fields: created & last_updated moved to Model. #3325

merged 1 commit into from Feb 14, 2018

Conversation

jortel
Copy link
Contributor

@jortel jortel commented Feb 12, 2018

Related to https://pulp.plan.io/issues/3337, the FileContent needed to be ordered by a created field. This seemed generally useful for other plugins for the same reason. Then, considered that a created timestamp would be useful on most models. So, why not add it to Model. Along the same line of thinking, why not add last_updated while we're at it. Should be generally useful for filtering/search and troubleshooting.

There are some concerns within the django community regarding auto_now and auto_now_add but I suggest we make this change independently of that. We should be revisited and fix on all models as needed.

Copy link
Contributor

@dparalen dparalen left a comment

Choose a reason for hiding this comment

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

Hi Jeff,

thanks for the patch!
I think the docstring needs to be corrected for the created attribute on the Model, otherwise LGTM.

Cheers,
milan

@@ -11,7 +11,9 @@ class Model(models.Model):
behavior.

Fields:
id: UUID ID Primary Key Field
id (models.UUIDField): UUID ID Primary Key Field
create (models.DateTimeField): Created timestamp UTC.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/create/created/

@@ -11,7 +11,9 @@ class Model(models.Model):
behavior.

Fields:
id: UUID ID Primary Key Field
id (models.UUIDField): UUID ID Primary Key Field
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: unrelated but OK

@@ -271,7 +266,7 @@ def content(self):
>>> repository_version = ...
>>>
>>> for content in repository_version.content:
>>> content = content.case() # optional downcast.
>>> content = content.cast() # optional downcast.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: unrelated, but OK

@@ -20,10 +22,9 @@ class Model(models.Model):
* https://www.postgresql.org/docs/current/static/datatype-uuid.html

"""
# ...we have zero interest in using a mongo-specific datatype (ObjectId) as
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: unrelated but OK

@jortel jortel changed the title Add Model.created and Model.last_updated. Fields: created & last_updated moved to Model. Feb 13, 2018
@dkliban dkliban self-assigned this Feb 14, 2018
Copy link
Member

@dkliban dkliban left a comment

Choose a reason for hiding this comment

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

Looks good to me. The docs builder is failing due to changes in sphinx and not because of changes in this PR.

@jortel jortel merged commit 545a11e into pulp:3.0-dev Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants