-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Version Model Update for Pull Request Builder #5750
Conversation
We may want to use managers or another pattern, feels like a lot of places where we can forget to exclude PRs from the actual versions |
4b64d7d
to
f8ecdb7
Compare
@@ -130,7 +130,7 @@ def active_versions(self, request, **kwargs): | |||
Project.objects.api(request.user), | |||
pk=kwargs['pk'], | |||
) | |||
versions = project.versions.filter(active=True) | |||
versions = project.versions(manager='internal').filter(active=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the normal way to handle this? Is it not normally project.versions.internal.filter
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes this is the normal way to do this if we use multiple managers.
ref: Dajngo Docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall!
build_pk=build.pk, | ||
version_pk=version.pk, | ||
) | ||
elif version == 'internal': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These options should be documented somewhere. Also we should be using constants for these, not strings INTERNAL = 'internal'
in projects/constants.py
or similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I'll Add them in the constants. Do we Document Management Commands Somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not currently -- perhaps we should do something like this: https://docs.readthedocs.io/en/latest/settings.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay i'll Add these in another PR.
Follow up from readthedocs#5798
We should check that |
About the slug, doesn't matter what we choose, the slug is unique. We add prefixes to make a slug unique if there is one with that slug. User creates a branch |
@stsewd I have already added some tests. I'll add some more to be more careful.
Then we have to add the prefix ( |
In the version model we have |
Closing this in favor of #5823, which should now be our feature branch for this work until it's merged into master. |
This PR will Update the Version Model to be used for Pull Request Builder.
Tasks:
VERSION_TYPES
Version
Model MethodsVersion
ModelManager
forinternal
andexternal
VersionsQuerysets
We need to think about how we want to create slugs for PR Versions. Should the slug be like this
pr-<number>
or only<pr_number>
. We have to think about how we can make pr version slugs unique so that it doesn't cause problems for the normal Versions. if we dopr-<number>
thevcs_url()
method of theVersion
Model needs to be updated.Feel free to let me know if there are other places that we need to update for this PR.
I would like to get some initial feedback's to continue the work on slug creation and writing tests.