Code Monkey home page Code Monkey logo

Comments (6)

chronossc avatar chronossc commented on August 16, 2024

@robnewman, in time I wrote this app, I have not used flatpages in urls like you showed.

Reading django 1.4.1 code right now, this include just to all django.ontrib.flatpges.views.flatpage, and, in that, we have nothing that I can connect and do breadcrumb 'magic'.

I check it fast, but as I see now, we have two options:
1 - Copy flatpage view to breadcrumbs, and change it to show breadcrumb.
2 - Write some decorator to apply to url, but I don't know if decoratores in urls.py work for includes.

I'll have time only by Sunday now, so if u want to fix with one of these options, I'll love to merge a pull request :).

from django-breadcrumbs.

robnewman avatar robnewman commented on August 16, 2024

Thanks for the rapid response. If I get time today or over the weekend I will fork and try to fix it.

from django-breadcrumbs.

chronossc avatar chronossc commented on August 16, 2024

Deal. With that fixed I issue release 1.1.2

from django-breadcrumbs.

robnewman avatar robnewman commented on August 16, 2024

I am actually starting to wonder if this is a non-issue. You can add a pseudo catchall by adding:

urlpatterns += patterns('django.contrib.flatpages.views',
    (r'^flatpagedirectory/$', 'flatpage'),
)

This will direct any request below 'flatpagedirectory/' to the flatpages app and your breadcrumbs resolve correctly.

You just have to ensure that is is placed below all your other url patterns so that it doesn't override your app specific views. Any request that doesn't match an app or a flatpage will just return a 404 anyway.

What do you think? If you agree, you could probably close this issue as a won't fix.

from django-breadcrumbs.

chronossc avatar chronossc commented on August 16, 2024

No, we really have a issue.

The (r'^flatpagedirectory/$', 'flatpage') returns a flatpage in url /flatpagedirectory/. If it exists in DB we go to stock flatpage view, and revelant code is at http://goo.gl/cmuCO ... if you see my code at http://goo.gl/ubo8j they are pretty similar, except that with flatpage object I call breadcrumbs_for_flatpages to build breadcrumbs.

So if we use stock flatpage view, we can't call breadcrumbs_for_flatpages and don't have breadcrumbs loaded (this apply to all examples in Django doc: http://goo.gl/iCvf3).

Now looking better at issue, to fix this we should:

1 - create a breadcrumbs.views.flatpage, that, is same as django.contrib.flatpages.views.flatpage, with addition of the call to breadcrumbs_for_flatpages like in current breadcrumbs.middleware.FlatpageFallbackMiddleware

2 - Make breadcrumbs.middleware.FlatpageFallbackMiddleware use that view, like stock middleware

3 - Change breadcrumbs docs to instruct to use breadcrumbs.views.flatpage instead django.contrib.flatpages.views.flatpage in url conf.

from django-breadcrumbs.

robnewman avatar robnewman commented on August 16, 2024

Sounds like you have a good grasp of how to fix it (at least better than me right now).

from django-breadcrumbs.

Related Issues (8)

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.