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

Fixed redirect to cycle with data #1528

Merged
merged 1 commit into from
Dec 1, 2017

Conversation

patphongs
Copy link
Member

Summary

  • Addresses Restore redirect for most recent cycle #1461
  • Previous implementation was using a url_for function to construct the redirect, which is using a flask function. To fix this, we needed to convert the redirect to use a django url constructor. Django's reverse() was used in the PR.

Impacted areas of the application

List general components of the application that this PR will affect:

Copy link
Member

@lbeaufort lbeaufort left a comment

Choose a reason for hiding this comment

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

@patphongs, great work on this! I read the documentation and played with a couple options but I think this is the best way I can think of implementing this. I'll test thoroughly because I know this impacts multiple parts of the application.

@lbeaufort
Copy link
Member

@patphongs I've tested locally but not exhaustively.

@patphongs
Copy link
Member Author

@ccostino Could use an extra pair of eyes 👀 on this PR too as it might have wide ranging effects on the committee portion of our site. Just to help double check. Thanks!

Copy link
Contributor

@ccostino ccostino left a comment

Choose a reason for hiding this comment

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

Thank you, @patphongs! All looks good to me here and working fine after testing!

# )
if financials['reports']:
return redirect(
reverse('committee-by-id', kwargs={'committee_id': committee['committee_id']}) + '?cycle=' + str(c)
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought that Django had provided a way to add query string parameters to URLs, but apparently not as this ticket is still open. :-)

@@ -8,7 +8,7 @@
url(r'^data/search/$', views.search),
url(r'^data/advanced/$', views.advanced),
url(r'^data/candidate/(?P<candidate_id>\w+)/$', views.candidate),
url(r'^data/committee/(?P<committee_id>\w+)/$', views.committee),
url(r'^data/committee/(?P<committee_id>\w+)/$', views.committee, name='committee-by-id'),
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that with this extra name argument any template making use of this URL can reference it via the name now, too! Here's an example in the Django documentation in case that helps. :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @ccostino ! It would be nice to add a name for all of them, I think it just helps to understand semantically what each pattern does.

@lbeaufort lbeaufort merged commit 50b0cb9 into develop Dec 1, 2017
@lbeaufort lbeaufort deleted the feature/1461-current-cycle-redirect branch December 1, 2017 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants