raiderrobert / django-multiurl Goto Github PK
View Code? Open in Web Editor NEWHave you ever wanted multiple views to match to the same URL? Now you can.
License: BSD 3-Clause "New" or "Revised" License
Have you ever wanted multiple views to match to the same URL? Now you can.
License: BSD 3-Clause "New" or "Revised" License
Hi!
Thanks for package!
Unfortunately, it doesn't work with Django==3.2.2.
I used to have a "catch-all" view that would execute other views (defined in settings), but I really like django-multiurl
and find it more flexible in that each URL can still be named, reversed, and accept different args and kwargs, etc.
I've run into a problem where I have a new project that needs to install an existing project (that was previously standalone) as an app in the new project. The new project already has a couple of views wrapped in multiurl()
, but I also want to include()
the URLs from the old project, at the same (root) level.
This doesn't seem to be possible with multiurl
at the moment, which comments seem to indicate does not support include()
, which took me a while to figure out after attempting to wrap existing existing views (include()
and all) with multiurl()
as per the README.
I can put my new project's multiurl()
views ahead of the include()
for old URLs, but I get a 404 and an error page that lists only the URLs wrapped in multiurl()
when I attempt to access a URL from the old project.
If I put the include()
for the old project ahead of the new project's multiurl()
, then the multiurl()
URLs are never even attempted.
I see in the comments that MultiRegexURLResolver
doesn't need to handle include()
and so it is simpler. But does it have to be this way? I would really like to be able to use both url()
and include()
inside multiurl()
, when trying to integrate multiple apps into a shared URL space within the root URL conf.
If you have any objections to this, and any tips on how it might be implemented or any hurdles you are already aware of, I'd be happy to have a go at implementing support for this?
Thanks for django-multiurl, wish I'd discovered it earlier.
Speaking of discoverability, there is no README on pypi.
IIRC I think setup.cfg or .py need to be updated to make it work.
I have some views wrapped by multiurl()
. One has a form upload and I want to modify the upload handlers list on the fly as per the Django docs.
I decorate my view with @csrf_exempt and have it wrap a private view function which is decorated with @csrf_protect.
But CsrfViewMiddleware
sees multiview
as the view function, and multiview
does not have a csrf_exempt
attribute.
I'm not sure what would be the correct approach here. Add a kwarg to multiurl()
for a decorator (or multiple decorators) and apply them to the multiview()
function that gets created?
But even then, those decorators may not applicable to all the wrapped views.
There might be other similar compatibility issues with middleware that make use of decorators to alter behaviour for specific view functions.
It would be great if you could release the Django 1.9 compatible version on pypi.
Thanks.
When using django-multiurl with Django 2.2 I get the following error:
Traceback (most recent call last):
File "/Users/username/.Envs/env/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/Users/username/.Envs/env/lib/python3.6/site-packages/django/core/handlers/base.py", line 100, in _get_response
resolver_match = resolver.resolve(request.path_info)
File "/Users/username/.Envs/env/lib/python3.6/site-packages/django/urls/resolvers.py", line 563, in resolve
self._join_route(current_route, sub_match.route),
AttributeError: 'MultiResolverMatch' object has no attribute 'route'
Using Django 2.1 the same works fine. Any ideas on how to fix this?
TypeError at /collaborate/individuals/
page() takes at least 2 arguments (2 given)
at mezzanine/pages/middleware.py in process_view, line 80
Basically, the middleware trying to do some fancy checking - this includes resolving some possible url options. While its failing for some other reason, I believe even if it was passing, there is going to be a recursion problem.
Django 2.0 drops with big changes to how urls work, but also Python 2 deprecation. Need to handle the Python 2 deprecation more gracefully.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.