Skip to content

Bugfix urls namespace and add reverse to missing usages in tests#428

Merged
kbeker merged 1 commit intomasterfrom
bugfix-fix-urls-namespace
Jul 15, 2019
Merged

Bugfix urls namespace and add reverse to missing usages in tests#428
kbeker merged 1 commit intomasterfrom
bugfix-fix-urls-namespace

Conversation

@rwrzesien
Copy link
Contributor

While cleaning up I have seen that we are still using the same url namespace for two Django apps. This should be avoided if not needed, so I have added the fix. Due to this I have discovered there were some places in which we were using hardcoded urls, so I have switched them to use reverse.

@rwrzesien rwrzesien added the bug Something isn't working label Jul 12, 2019
@rwrzesien rwrzesien self-assigned this Jul 12, 2019
Copy link
Contributor

@dybi dybi left a comment

Choose a reason for hiding this comment

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

LGMT, just one suggestion.

"next_month_url": "/reports/project/1/2019/4/",
"recent_month_url": f"/reports/project/1/{current_date.year}/{current_date.month}/",
"previous_month_url": "/reports/project/1/2019/2/",
"next_month_url": reverse("project-report-list", args=(self.mixin.kwargs["pk"], 2019, 4)),
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that sometimes we use args and sometimes kwargs in url building. I would suggest that we don't mix them up. My personal choice would be kwargs (greater readability). @rwrzesien, what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would also prefer kwargs because we can see all keys and values associated with them. If you agree @rwrzesien I can change it for you and merge today :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I prefer kwargs too, I just do it in little rush yesterday, go ahead and fix it if you want :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated it.

"next_month_url": "/reports/project/1/2019/4/",
"recent_month_url": f"/reports/project/1/{current_date.year}/{current_date.month}/",
"previous_month_url": "/reports/project/1/2019/2/",
"next_month_url": reverse("project-report-list", args=(self.mixin.kwargs["pk"], 2019, 4)),
Copy link
Contributor

Choose a reason for hiding this comment

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

I would also prefer kwargs because we can see all keys and values associated with them. If you agree @rwrzesien I can change it for you and merge today :)

@rwrzesien rwrzesien force-pushed the bugfix-fix-urls-namespace branch 2 times, most recently from 1d01317 to 653e348 Compare July 12, 2019 22:53
@kbeker kbeker force-pushed the bugfix-fix-urls-namespace branch from 653e348 to 45e00d2 Compare July 15, 2019 13:17
@kbeker kbeker merged commit 45e00d2 into master Jul 15, 2019
@kbeker kbeker deleted the bugfix-fix-urls-namespace branch July 15, 2019 13:22
@kbeker kbeker added this to the next_release milestone Jul 15, 2019
@kbeker kbeker changed the title Fix urls namespace and add reverse to missing usages in tests Bugfix urls namespace and add reverse to missing usages in tests Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants