from django.contrib import admin

from .models import AccessToken


class AccessTokenAdmin(admin.ModelAdmin):
    raw_id_fields = ('user',)


admin.site.register(AccessToken, AccessTokenAdmin)

from django.contrib import admin

from .models import AccessToken


class AccessTokenAdmin(admin.ModelAdmin):
    raw_id_fields = ('user',)
    list_filter = ('purpose',)
    search_fields = ('user__email',)


admin.site.register(AccessToken, AccessTokenAdmin)

Add search, filter to access tokens
Add search, filter to access tokens
  from django.contrib import admin
  
  from .models import AccessToken
  
  
  class AccessTokenAdmin(admin.ModelAdmin):
      raw_id_fields = ('user',)
+     list_filter = ('purpose',)
+     search_fields = ('user__email',)
  
  
  admin.site.register(AccessToken, AccessTokenAdmin)
  
Add search, filter to access tokens
## Code Before:
from django.contrib import admin

from .models import AccessToken


class AccessTokenAdmin(admin.ModelAdmin):
    raw_id_fields = ('user',)


admin.site.register(AccessToken, AccessTokenAdmin)

## Instruction:
Add search, filter to access tokens
## Code After:
from django.contrib import admin

from .models import AccessToken


class AccessTokenAdmin(admin.ModelAdmin):
    raw_id_fields = ('user',)
    list_filter = ('purpose',)
    search_fields = ('user__email',)


admin.site.register(AccessToken, AccessTokenAdmin)
