Added GoogleLoginView and GoogleAuthUrlView to exchange auth code for tokens, create or link users, and return refresh/access tokens. Updated User model with Google ID and serializers for profile data.
24 lines
737 B
Python
24 lines
737 B
Python
from django.contrib import admin
|
|
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
|
|
|
from src.accounts.models import Setting, User
|
|
|
|
|
|
@admin.register(User)
|
|
class UserAdmin(BaseUserAdmin):
|
|
list_display = ("id", "email", "name", "is_staff", "is_active")
|
|
search_fields = ("email", "name")
|
|
ordering = ("email",)
|
|
fieldsets = BaseUserAdmin.fieldsets + (("Extra", {"fields": ("google_id",)}),)
|
|
|
|
@admin.display(description="Name")
|
|
def name(self, obj):
|
|
return obj.get_full_name() or obj.username
|
|
|
|
|
|
@admin.register(Setting)
|
|
class SettingAdmin(admin.ModelAdmin):
|
|
list_display = ("id", "user", "group", "key", "value")
|
|
list_filter = ("group",)
|
|
search_fields = ("key", "value", "user__email")
|