Giter Site home page Giter Site logo

Comments (7)

0xE111 avatar 0xE111 commented on July 24, 2024

Move your cursor over the link and press left mouse button

from django-mptt-urls.

asing177 avatar asing177 commented on July 24, 2024

these are static...cant they be made dynamic...like url 'categories'

from django-mptt-urls.

0xE111 avatar 0xE111 commented on July 24, 2024

@adityasingh177 I absolutely totally don't understand what you're saying. If you want to get dynamic urls for any category instance, use instance.get_absolute_url()

from django-mptt-urls.

asing177 avatar asing177 commented on July 24, 2024

it doesnt work when i am calling the instance.get_absolute_url() from another page that is outside the mptt tree...

from django-mptt-urls.

0xE111 avatar 0xE111 commented on July 24, 2024

You should provide code example.

from django-mptt-urls.

asing177 avatar asing177 commented on July 24, 2024

Another.html

Categories :-
weddings > Dexter and Rita
My Pets > Dogs > Husky

'''

'''

i am a beginner.
How can i give Links in "a hrefs " here....thanks in advance...

from django-mptt-urls.

0xE111 avatar 0xE111 commented on July 24, 2024

From your views.py pass desired instances to your template, like this:

def another_page(request):
    return render(
        request,
        'another.html',
        {'categories': Category.objects.all()}
    )

Then in another.html:

{% for category in categories %}
    {{ category.get_absolute_url }}
{% endfor %}

Note that in your models.py file you need to set up def get_absolute_url() for your Category model, as described here https://github.com/c0ntribut0r/django-mptt-urls in section get_absolute_url().

from django-mptt-urls.

Related Issues (12)

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.