import os
import django

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "backend.settings")
django.setup()

from core.views import MemberViewSet
from django.test import RequestFactory

request = RequestFactory().get('/api/admin/members/PLP-YAMD1D/')
view = MemberViewSet(request=request, kwargs={'pk': 'PLP-YAMD1D'})
try:
    obj = view.get_object()
    print("FOUND:", obj.membership_id)
except Exception as e:
    print("ERROR:", str(e))
