o
    ÁI7i¦  ã                   @   sÔ   d dl mZ d dlmZmZ d dlmZ d dlmZ d dl	m
Z d dlmZ d dl mZ G dd„ deƒZG d	d
„ d
eƒZe e¡G dd„ dejƒƒZe e¡G dd„ dejƒƒZG dd„ deƒZG dd„ deƒZ
dS )é    )Úadmin)ÚModelChoiceFieldÚ	ModelForm)ÚAccount)ÚTransaction)Ú	UserAdmin)ÚUserCreationFormc                   @   s   e Zd Zdd„ ZdS )ÚCustomAccountChoiceFieldc                 C   s   d|j › �S )NzIBAN: ©Úiban©ÚselfÚobj© r   úFC:\Users\Uzivatel\Documents\attachments\prilohy\bp_ib\banking\admin.pyÚlabel_from_instance   s   z,CustomAccountChoiceField.label_from_instanceN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r	      s    r	   c                   @   s:   e Zd Zeej ¡ d�Zeej ¡ d�ZG dd„ dƒZ	dS )ÚCustomTransactionAdminForm)Úquerysetc                   @   s   e Zd ZeZdZdS )zCustomTransactionAdminForm.MetaÚ__all__N)r   r   r   r   ÚmodelÚfieldsr   r   r   r   ÚMeta   s    r   N)
r   r   r   r	   r   ÚobjectsÚallÚpayerZbeneficiaryr   r   r   r   r   r      s    r   c                   @   s$   e Zd ZdZdZdZdZdZeZ	dS )ÚBankingTransactionÚcreated)Úamountr   r   )r    )Úis_processed)r   r!   N)
r   r   r   Údate_hierarchyÚlist_displayÚlist_display_linksÚlist_filterÚreadonly_fieldsr   Úformr   r   r   r   r      s    r   c                   @   s4   e Zd ZdZdZdZddiZejdd�dd„ ƒZ	d	S )
ÚBankingAccount)ÚuserÚaccount_ibanÚbalance)r)   Úslug)r)   r   zAccount iban)Údescriptionc                 C   s   |j S )Nr
   r   r   r   r   r*   +   s   zBankingAccount.account_ibanN)
r   r   r   r#   r%   r$   Úprepopulated_fieldsr   Údisplayr*   r   r   r   r   r(   $   s    
r(   c                   @   s   e Zd ZG dd„ dejƒZdS )r   c                   @   s   e Zd ZdZdS )zUserCreationForm.Meta)ÚusernameÚ
first_nameÚ	last_nameÚemailN)r   r   r   r   r   r   r   r   r   1   s    r   N)r   r   r   ÚBaseUserCreationFormr   r   r   r   r   r   0   s    r   c                   @   s   e Zd ZeZdddiffZdS )r   Nr   )r0   r1   r2   r3   Ú	password1Ú	password2)r   r   r   r   Úadd_formÚadd_fieldsetsr   r   r   r   r   4   s    ÿÿr   N)Zdjango.contribr   Zdjango.formsr   r   Zbanking.models.accountr   Zbanking.models.transactionr   Zdjango.contrib.auth.adminr   ÚBaseUserAdminÚdjango.contrib.auth.formsr   r4   r	   r   ÚregisterÚ
ModelAdminr   r(   r   r   r   r   Ú<module>   s    		