I have an existing project that has no views.py and models.py.It has a user login system.I want to get the list of all user in the template.I have searched more but found no solution.
Asked
Active
Viewed 100 times
0
-
https://github.com/mgaby25/django-postman-sample this the app that I want to use. – Omar Faruk Sazib Mar 08 '17 at 20:20
-
2If there is no `views.py`, then you will have to create it. – Klaus D. Mar 08 '17 at 20:51
1 Answers
0
If you for some reason don't want views.py, you can create custom template tag:
@register.simple_tag
def user_list():
return '<br>'.join([str(u) for u in get_user_model().objects.all()])

rubick
- 508
- 1
- 5
- 13