-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
reverse and url tag should reverse urls without need of hostname in case of uniqness #72
Comments
Any body hearing me? |
I'm not sure that's a good idea as it seems to me as error-prone. You could easily add a url in the future that will break the uniqueness, and you wouldn't know about it. |
I use a function for this, and find it very helpful for getting django-hosts to play well with other libraries -- perhaps it would make sense to add as an option. I would have it use the last named URL provided rather than raise an error on uniqueness. I don't think uniqueness is a problem. Django specifically allows for re-using the same name and chooses the last one. If unintended collisions are a risk for your app, they're probably a risk regardless of how you use subdomains, and you should be using url namespaces. For people who want this before it's officially implemented, you can make your own reverse function like this:
... and monkeypatch it in wherever needed. |
(Oops, note also that this is a dupe of #19) |
As said in docs we must pass host-name in both
reverse
function andurl
template tag.I think it should be better if we could use something like
{% url 'view-name' %}
in a case that we don't have sameview-names
in different hosts. Or something likereverse(view_name)
in such cases.May I add this feature and make a merge request?
The text was updated successfully, but these errors were encountered: