Skip to content
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.

Convert hardcoded URLs to dynamic ones #64

Merged
merged 3 commits into from
Aug 29, 2017
Merged

Conversation

chosak
Copy link
Member

@chosak chosak commented Aug 25, 2017

This change removes usage of hardcoded URLs in favor of using Django's django.core.urlresolvers.reverse and {% url %} template tag to better support cases where this app is being deployed under a website's subdirectory.

For example, if this app is deployed under a /eregs-2.0 subdirectory, regulation URLs should be under /eregs-2.0/regulation/etc, and not under a hardcoded /regulation/etc.

In addition, a couple of hardcoded /static references in templates have been converted to use of Django's {% static %} tag, for a similar reason.

Changes

  • Hardcoded URLs instead now use django.core.urlresolvers.reverse and {% url %}.
  • Hardcoded references to /static now use {% static %}.

Testing

  • All existing unit tests continue to pass, and working site functionality continues to do so.

Checklist

  • Changes are limited to a single goal (no scope creep)
  • Code can be automatically merged (no conflicts)
  • Code follows the standards laid out in the front end playbook
  • Passes all existing automated tests
  • Visually tested in supported browsers and devices

This change removes usage of hardcoded URLs in favor of using Django's
`django.core.urlresolvers.reverse` and `{% url %}` template tag to
better support cases where this app is being deployed under a website's
subdirectory.

For example, if this app is deployed under a `/eregs-2.0` subdirectory,
regulation URLs should be under `/eregs-2.0/regulation/etc`, and not
under a hardcoded `/regulation/etc`.

In addition, a couple of hardcoded `/static` references in templates
have been converted to use of Django's `{% static %}` tag, for a similar
reason.

All existing unit tests continue to pass, and working site functionality
continues to do so.
Copy link
Contributor

@grapesmoker grapesmoker left a comment

Choose a reason for hiding this comment

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

Looks great.

@chosak chosak merged commit edf6deb into master Aug 29, 2017
@chosak chosak deleted the avoid-hardcoded-urls branch August 29, 2017 15:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants