How to create a a drop-down menu from the logged in username

239 views
Skip to first unread message

Sandip Nath

unread,
Sep 9, 2019, 4:28:29 AM9/9/19
to Django users
Am new to Django. Am trying to build a car rental web site. After logging in the home page navbar at the top is showing the "hello <username>" as expected. But I want a drop-down menu from that welcome message which will contain the user edit profile option, his/her bookings and a logout options. I have created edit profile and logout features but they are separately shown. How can I bring them under the drop-down menu in the "hello <username> welcome message?
Please give a detailed explanation.

Gil Obradors

unread,
Sep 9, 2019, 5:10:52 AM9/9/19
to django...@googlegroups.com
Combination of 
Backend ( django view , for manage data)
Template ( bootstrap nav dropdown menus, for example )






El dl., 9 de set. 2019, 10:29, Sandip Nath <techs...@gmail.com> va escriure:
Am new to Django. Am trying to build a car rental web site. After logging in the home page navbar at the top is showing the "hello <username>" as expected. But I want a drop-down menu from that welcome message which will contain the user edit profile option, his/her bookings and a logout options. I have created edit profile and logout features but they are separately shown. How can I bring them under the drop-down menu in the "hello <username> welcome message?
Please give a detailed explanation.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1a839db3-af01-401b-8f76-a487da4843c8%40googlegroups.com.

Tosin Ayoola

unread,
Sep 9, 2019, 5:11:09 AM9/9/19
to django...@googlegroups.com
I feel bootstrap can handle that 

On Sep 9, 2019 09:28, "Sandip Nath" <techs...@gmail.com> wrote:
Am new to Django. Am trying to build a car rental web site. After logging in the home page navbar at the top is showing the "hello <username>" as expected. But I want a drop-down menu from that welcome message which will contain the user edit profile option, his/her bookings and a logout options. I have created edit profile and logout features but they are separately shown. How can I bring them under the drop-down menu in the "hello <username> welcome message?
Please give a detailed explanation.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

Mugabi Timothy

unread,
Sep 9, 2019, 7:33:36 AM9/9/19
to django...@googlegroups.com
you can use the above list dropdown but use the templating engine in django

On Mon, Sep 9, 2019 at 12:00 PM Mugabi Timothy <mgbt...@gmail.com> wrote:
     <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="https://example.com" id="dropdown01" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">welcome {{request.user.username}}</a>
                    <div class="dropdown-menu" aria-labelledby="dropdown01">
                        <a class="dropdown-item" href="{% url 'user_profile:profile' %}">Profile</a>
                        <div class="dropdown-divider"></div>
                        <a class="dropdown-item" href="{% url 'account_change_password' %}">Change Password</a>
                        <div class="dropdown-divider"></div>
                        <a class="dropdown-item" href="{% url 'account_logout' %}">Logout</a>
                    </div>
       </li>  

Reply all
Reply to author
Forward
0 new messages