Namespaces not taken into account
See original GitHub issueI wanted to distill views from an app (via python manage.py distill-local
), but I think distill does not take namespaces into account…
I tried with following setup:
# base urls.py
urlpatterns = [
...
path("", include("djagora.map.urls", namespace="map")),
]
# map/urls.py
app_name = "map"
urlpatterns = [
...
distill_path(
"some_view/",
view=views.SomeView.as_view(),
name="some",
),
]
But this lead to an error when generating uri:
https://github.com/meeb/django-distill/blob/ea6132b6c21c73265c5b80389c9fb448c9eb7297/django_distill/renderer.py#L81
as view_name
only contains "some"
, but correct reverse name would be "map:some"
.
After setting view_name = "map:some"
within debugging mode, script goes on without error (giving me some errors later, but this does not belong here).
Can you confirm this error, or am I missing something?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Namespaces
In Kubernetes, namespaces provides a mechanism for isolating groups of resources within a single cluster. Names of resources need to be unique ...
Read more >Namespaces not found by the compiler - c++
Then in one of the files I am trying to incorporate the classes from the others. The issue is that the compiler seems...
Read more >The Trouble with Namespaces - Spatial's Blog
The first thing to make clear is that I am NOT saying that namespaces are bad. The fundamental problem that namespaces solve is...
Read more >Namespaces - cppreference.com
Namespaces provide a method for preventing name conflicts in large projects. Symbols declared inside a namespace block are placed in a named ...
Read more >XML Schema: Understanding Namespaces
Moving to XML Schema? This introduction to namespaces will help you understand one of its more important elements.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In the just pushed commit adds partial namespace support including nested namespaces. The only situation where namespaces are not supported is
include()
ing the same set of URLs more than once on the same project, which will raise a polite and detailed error. So this is fine:But this will throw an error:
As in, including
someapp.urls
more than once in the same project. Different URLs are fine. This is because the only sane way to map URLs to their namespace is to use the URL function itself (which matches theid(urlfunc)
in most Python interpreters). The second example would reference the same URL more than once, making it impossible to work out which namespace it belongs to. Hopefully this partial implementation is sufficient for all but the most unusual deployments.I’ll write a test case to check for namespaced inclusion and push any fixes into the next
distill
release when I get a moment.