Git Product home page Git Product logo

Comments (10)

phpdude avatar phpdude commented on September 23, 2024 1

@dalberto I wait when it will be native in Django (or any alternative) because it is simple and covers 90% of user cases, but anyway, it is small, clear and integrated very well into Django, so I start all my projects from installing macros library :)

from django-macros-url.

phpdude avatar phpdude commented on September 23, 2024

Hi Darlin,

I think it is not good idea because for search engines "/page/" and "/page" are different (and for example better is to have 301 redirect from "/page" to "/page/"). This can be added only as option, better is to use append slash django feature (https://docs.djangoproject.com/en/1.9/ref/settings/#append-slash).

But anyway it is good idea, I will think (and will read django source code) about it.

Thanks!

from django-macros-url.

dalberto avatar dalberto commented on September 23, 2024

Thanks for the speedy reply.
On second thought, I suppose this is unnecessary because a macro can be written for the optional trailing slash. I'm not sure if this will have unknown side-effects.

from django-macros-url.

phpdude avatar phpdude commented on September 23, 2024

@dalberto yes it can of course. But I am not sure it is good way, please check APPEND_SLASH django feature.

from django-macros-url.

phpdude avatar phpdude commented on September 23, 2024

https://github.com/django/django/blob/master/django/middleware/common.py#L69

from django-macros-url.

phpdude avatar phpdude commented on September 23, 2024

Django handles this best way I think ;)

https://github.com/django/django/blob/master/django/middleware/common.py#L39

from django-macros-url.

dalberto avatar dalberto commented on September 23, 2024

Oh, thanks! Sorry for the extraneous request, feel free to close this issue.

from django-macros-url.

phpdude avatar phpdude commented on September 23, 2024

Only one stuff can be done - auto trailing slash (strict, all urls ends with "/") to make all urls more elegant and allow developer forget about trailing slashes at all. I mean force "/" without "?".

from django-macros-url.

phpdude avatar phpdude commented on September 23, 2024

I double checked source code, looks like force add slash to end of rule is bad idea because user will not have any chance to remove it, only hacks like str(url(..)) but it is ugly for me and I don't want to do it. So I close the issue.

Anyway thanks for your ideas.

from django-macros-url.

dalberto avatar dalberto commented on September 23, 2024

Thanks for your help nevertheless. This library has proven very useful!

from django-macros-url.

Related Issues (3)

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.