Coder Social home page Coder Social logo

raiderrobert / django-multiurl Goto Github PK

View Code? Open in Web Editor NEW
274.0 13.0 30.0 63 KB

Have you ever wanted multiple views to match to the same URL? Now you can.

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
python django url routing exception-handling 404

django-multiurl's People

Contributors

1vank1n avatar freyes avatar igerko avatar jacobian avatar mikaelengstrom avatar raiderrobert avatar rinti avatar sssbox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-multiurl's Issues

Add support for `include()`?

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?

Upload the README to pypi

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.

`multiurl()` can break decorator/middleware behaviour on wrapped views.

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.

Release 1.1.0 on Pypi

It would be great if you could release the Django 1.9 compatible version on pypi.

Thanks.

Support for Django 2.2

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?

Conflict with mezzanine.pages.middleware.PageMiddleware

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.

Add-in support for Django 2.0

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.