Skip to content
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

Stop building redirects when a Project's Org is changed #3527

Merged
merged 1 commit into from
Sep 11, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion staff/views/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def form_valid(self, form):
# new.project because self.object is mutated when ModelForm._post_clean
# updates the instance it was passed. This is because form.instance is
# set from the passed in self.object.
if {"org", "slug"} & set(form.changed_data):
if "slug" in form.changed_data:
new.redirects.create(
created_by=self.request.user,
old_url=old.get_absolute_url(),
Expand Down
3 changes: 0 additions & 3 deletions tests/unit/staff/views/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,6 @@ def test_projectedit_post_success(rf, core_developer):
Redirect.objects.count() == 1
redirect = Redirect.objects.first()
assert redirect.project_id == original.pk
assert redirect.old_url == original.get_absolute_url().replace(
updated.org.get_absolute_url(), old_org.get_absolute_url()
)


def test_projectedit_post_success_when_not_changing_org_or_slug(rf, core_developer):
Expand Down