diff --git a/allauth/socialaccount/admin.py b/allauth/socialaccount/admin.py index 72743c575c..72308dbcbf 100644 --- a/allauth/socialaccount/admin.py +++ b/allauth/socialaccount/admin.py @@ -1,4 +1,5 @@ from django.contrib import admin +from django import forms from .models import SocialApp, SocialAccount, SocialToken @@ -8,7 +9,18 @@ User = get_user_model() +class SocialAppForm(forms.ModelForm): + class Meta: + model = SocialApp + widgets = { + 'client_id': forms.TextInput(attrs={'size': '100'}), + 'key': forms.TextInput(attrs={'size': '100'}), + 'secret': forms.TextInput(attrs={'size': '100'}) + } + + class SocialAppAdmin(admin.ModelAdmin): + form = SocialAppForm list_display = ('name', 'provider',) filter_horizontal = ('sites',) @@ -17,9 +29,9 @@ class SocialAccountAdmin(admin.ModelAdmin): search_fields = ['user__emailaddress__email'] + \ list(map(lambda a: 'user__' + a, filter(lambda a: a and hasattr(User(), a), - [app_settings.USER_MODEL_USERNAME_FIELD, - 'first_name', - 'last_name']))) + [app_settings.USER_MODEL_USERNAME_FIELD, + 'first_name', + 'last_name']))) raw_id_fields = ('user',) list_display = ('user', 'uid', 'provider') list_filter = ('provider',) diff --git a/allauth/socialaccount/models.py b/allauth/socialaccount/models.py index aa51d4e62a..b8ecf2f2fb 100644 --- a/allauth/socialaccount/models.py +++ b/allauth/socialaccount/models.py @@ -39,12 +39,12 @@ class SocialApp(models.Model): name = models.CharField(max_length=40) client_id = models.CharField(max_length=100, help_text='App ID, or consumer key') - key = models.CharField(max_length=100, - blank=True, - help_text='Key (Stack Exchange only)') secret = models.CharField(max_length=100, help_text='API secret, client secret, or' ' consumer secret') + key = models.CharField(max_length=100, + blank=True, + help_text='Key (Stack Exchange only)') # Most apps can be used across multiple domains, therefore we use # a ManyToManyField. Note that Facebook requires an app per domain # (unless the domains share a common base name).