You can include a template snippet into the body of the main template that 
is rendering your current view.

That snippet in turn can either be passed data (such as a user count) from 
the view that calls the main template - see  
http://code.runnable.com/UpeQSkq7JxN6AANF/dynamic-content-in-a-template-in-django-for-python
 
(but imagine the datetime.datetime.now() function being replaced by your 
own)

You can also create your own "tag" which makes the results from a function 
readily available - this example:
https://stackoverflow.com/questions/40498091/how-do-i-register-a-dynamic-inclusion-tag-within-django
looks like it might help you.

On Wednesday, 26 July 2017 13:52:54 UTC+2, Vivek wrote:
>
> Hello Guys
> I am new to django. i am working on a web app and one of the requirements 
> in the application is a dropdown list in the header that displays the 
> number of users registered to a company that logins( The list is limited to 
> just 10 users). so this list needs to be there for all the pages which the 
> company has access to.
>
> How do i make this list dynamic. Can i create a reusable component or 
> plugin that will just display this in the layout when i call it.
> Is there any other way of displaying this.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/70cb07b7-e16e-471a-8e87-7bb9f785d67b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to