o
    RDi8                     @   s   d dl mZ d dlmZ d dlmZ d dlmZmZm	Z	m
Z
mZ ddlmZ G dd deZG d	d
 d
eeZG dd dee	ZG dd dee
ZG dd deeZG dd deeZdS )    )LoginRequiredMixin)modelform_factory)reverse_lazy)
CreateView
DeleteView
DetailViewListView
UpdateView   )get_application_modelc                   @   s   e Zd ZdZdZdd ZdS )ApplicationOwnerIsUserMixinze
    This mixin is used to provide an Application queryset filtered by the current request.user.
    __all__c                 C   s   t  jj| jjdS )N)user)r   objectsfilterrequestr   self r   Z/var/www/Datamplify/venv/lib/python3.10/site-packages/oauth2_provider/views/application.pyget_queryset   s   z(ApplicationOwnerIsUserMixin.get_querysetN)__name__
__module____qualname____doc__fieldsr   r   r   r   r   r   	   s    r   c                       s,   e Zd ZdZdZdd Z fddZ  ZS )ApplicationRegistrationzF
    View used to register a new Application for the request.user
    z2oauth2_provider/application_registration_form.htmlc                 C      t t ddS zB
        Returns the form class for the application model
        )
name	client_idclient_secrethash_client_secretclient_typeauthorization_grant_typeredirect_urispost_logout_redirect_urisallowed_origins	algorithm)r   r   r   r   r   r   r   get_form_class      z&ApplicationRegistration.get_form_classc                    s   | j j|j_t |S )N)r   r   instancesuper
form_valid)r   form	__class__r   r   r.   /   s   z"ApplicationRegistration.form_valid)r   r   r   r   template_namer*   r.   __classcell__r   r   r0   r   r      s
    r   c                   @      e Zd ZdZdZdZdS )ApplicationDetailzK
    Detail view for an application instance owned by the request.user
    applicationz'oauth2_provider/application_detail.htmlNr   r   r   r   context_object_namer2   r   r   r   r   r5   4       r5   c                   @   r4   )ApplicationListzF
    List view for all the applications owned by the request.user
    applicationsz%oauth2_provider/application_list.htmlNr7   r   r   r   r   r:   =   r9   r:   c                   @   s    e Zd ZdZdZedZdZdS )ApplicationDeletezF
    View used to delete an application owned by the request.user
    r6   zoauth2_provider:listz/oauth2_provider/application_confirm_delete.htmlN)r   r   r   r   r8   r   success_urlr2   r   r   r   r   r<   F   s
    r<   c                   @   s    e Zd ZdZdZdZdd ZdS )ApplicationUpdatezF
    View used to update an application owned by the request.user
    r6   z%oauth2_provider/application_form.htmlc                 C   r   r   r)   r   r   r   r   r*   X   r+   z ApplicationUpdate.get_form_classN)r   r   r   r   r8   r2   r*   r   r   r   r   r>   P   s
    r>   N)django.contrib.auth.mixinsr   django.forms.modelsr   django.urlsr   django.views.genericr   r   r   r   r	   modelsr   r   r   r5   r:   r<   r>   r   r   r   r   <module>   s     		
