Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-friendly backend names #132

Closed
mikek opened this issue Dec 25, 2013 · 2 comments
Closed

User-friendly backend names #132

mikek opened this issue Dec 25, 2013 · 2 comments

Comments

@mikek
Copy link

mikek commented Dec 25, 2013

Say, site has no icons for backends (yet). What is an expected workflow to display full backend/provider name to the user? The backend class only stores name, which is good for the slug or db value, not for a title.

The temporary dirty workaround for Django looks like: {{ backend|split:'-'|first|capfirst }} (split is a custom filter). Not all backend names are properly displayed in such a way.

Don't you plan to add a nice (translatable) title to the class or store it in DB?

@omab
Copy link
Owner

omab commented Dec 25, 2013

I'm not planing to do so, usually a website enables a few backends and won't iterate over a long backends list, so you will write links in the form <a href="{% url 'social:begin' 'google-oauth2' %}">Google</a>. It might be even simple to create a custom filter in your project that does:

def backend_friendly_name(backend):
    return {
        GoogleOAuth2: 'Google',
        TwitterOAuth: 'Twitter',
        FacebookOAuth2: 'Facebook',
        ...
    }[backend]

@mikek
Copy link
Author

mikek commented Dec 25, 2013

I am trying to avoid hardcoding backends and really ended up with a similar custom template tag. Thanks.

@mikek mikek closed this as completed Dec 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants