Search code examples
pythondjangodjango-templatesdjango-allauth

Django template, display list of links as just links (remove list)


The problem

I am using Django with allauth to facilitate social logins. The allauth standard template includes social logins via:

  {% include "socialaccount/snippets/provider_list.html" with process="login" %}

However, this displays a list of a tags with bullet points on the page like:

  • Facebook
  • Google

I would like to display the items as just a tags and not within a list.

What I've tried

I have tried:

    {% for social in "socialaccount/snippets/provider_list.html" %}
        {{ social }}
    {% endfor %}

But this returns individual letters of the link address! Like:

s o c i a l a c c o u n t / s n i p p e t s / p r o v i d e r _ l i s t . h t m l

Could somebody point me in the right direction as to how to show the social links without displaying them as a list with bullet points?


Solution

  • You have to override the default template of allauth provider_list.html in order to achieve your result. Here is the link to the default template

    The reason your for loop doesn't work is because it is just iterating over the characters in the string and then writing them in the template.

    {% for social in "socialaccount/snippets/provider_list.html" %}
        {{ social }}
    {% endfor %}
    

    See this answer for details on how to edit default templates