Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Added a factory for Redirect model #83
base: main
Are you sure you want to change the base?
Added a factory for Redirect model #83
Changes from all commits
38d8543
5ed7344
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Issue: I don't think we should be calling
clean
here, as it may clobber the values provided by a user. There are scenarios in which you may want to provide invalid data to a model instance — for example, if you want to test theclean
method itself. I think our approach should be to make a best effort to generate example data that is both valid, and matches the typical usage of the object — but give the user the ability to create objects with data however they want, if they need to.I would love to see a custom faker provider developed for
old_path
. We could use uri_path as a starting point (just using slugs is a little deficient).old_path
also accepts query parameters, for which we could use pydict as a source. An API using traits to enable flags likehas_query_params
would be the icing on the cake.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.
A bit more context on whether or not we should call
clean
:full_clean
insave
by default (https://docs.djangoproject.com/en/5.0/ref/models/instances/#django.db.models.Model.full_clean)Page
models, but it is optional, and exists to facilitate restoring revisions (https://github.com/wagtail/wagtail/blob/main/wagtail/models/__init__.py#L1495)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.
Suggestion:
isinstance
is a more conventional way to do this.