
    R1i                     &    d dl mZ  G d de      Zy)    )OpenApiViewExtensionc                       e Zd ZdZdZd Zy)ObtainAuthTokenViewz.rest_framework.authtoken.views.ObtainAuthTokenTc                 p    ddl m} ddlm |dk\  r| j                  S  G fdd| j                        }|S )a  
        Prior to DRF 3.12.0, usage of ObtainAuthToken resulted in AssertionError

            Incompatible AutoSchema used on View "ObtainAuthToken". Is DRF's DEFAULT_SCHEMA_CLASS ...

        This is because DRF had a bug which made it NOT honor DEFAULT_SCHEMA_CLASS and instead
        injected an unsolicited coreschema class for this view and this view only. This extension
        fixes the view before the wrong schema class is used.

        Bug in DRF that was fixed in later versions:
        https://github.com/encode/django-rest-framework/blob/4121b01b912668c049b26194a9a107c27a332429/rest_framework/authtoken/views.py#L16
        r   )VERSION
AutoSchemaz3.12c                       e Zd Z W         Zy)BObtainAuthTokenView.view_replacement.<locals>.FixedObtainAuthTokenN)__name__
__module____qualname__schemar   s   j/home/cursorai/projects/iching/venv/lib/python3.12/site-packages/drf_spectacular/contrib/rest_framework.pyFixedObtainAuthTokenr      s
    \F    r   )rest_frameworkr   drf_spectacular.openapir	   target)selfr   r   r	   s      @r   view_replacementz$ObtainAuthTokenView.view_replacement   s7     	+6 f;;	"4;; 	" $#r   N)r   r   r   target_classmatch_subclassesr    r   r   r   r      s    CL$r   r   N)drf_spectacular.extensionsr   r   r   r   r   <module>r      s    ;$. $r   