Dropdown Editable

I would like to create a dropdown menu that can be modified within the admin panel. Do you happen to know if this is feasible?

Where, and to do what?

Also, from this combined with your other recent post, I’m going to point this out from the docs for The Django admin site | Django documentation | Django

The admin’s recommended use is limited to an organization’s internal management tool. It’s not intended for building your entire front end around.


If you need to provide a more process-centric interface that abstracts away the implementation details of database tables and fields, then it’s probably time to write your own views.

I strongly suggest you don’t build your system around the admin. That’s really not what it’s designed for.

Hey Ken,

one more time, thank you for explanations!

I’m creating something like a blog for a student’s organization, and if the students want to increase another link on a dropdown, they’ll call me and I’ll change this on html code.

But, I’m trying to not be called. I want to implement a dropdown that can be changed on admin panel. I don’t know if it’s the better choice, if you have ideas, i’m really open to any discussion.

You want a dynamic drop down that you can use in your site?
You should create a Model and pass it’s object from the views to the template where you want to use it, iterate over it and list it down within your drop down code. With this you can add, update and delete your drop down values from the admin site.

Thanks! So, that’s possible!

And you know if can I do a dynamic drop down on navbar? Because I already tried and I didn’t get :frowning:

The navbar might have separate html file i.e navbar.html and your are including it in base.html right?

Yes, that’s it. (I have to complete 30 characteres)

Okay, so you cannot pass context data to html parts code from views but there is another way around.
First you need to create custom template tags and then you can use them to iterate within any html parts code, sharing you some code for the reference. If you know about custom template tags use it, if not here is docs How to create custom template tags and filters | Django documentation | Django


from django import template
from path.path.models import Category

register = template.Library()

def cat_names():
    categories = Category.objects.all().order_by('name')
    return categories

{% load general_tags %}
{% cat_names as category %}

<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
    {% for item in category %}
        <a class="dropdown-item text-white" href="#">
            {{ item.category_name }}
    {% endfor %}

Thank you! I’ll try today, tomorrow or soon I’ll back with news.