from django.contrib import admin
from django.utils.translation import gettext_lazy as _

from users.imports.admin import BaseModelAdmin as Parent
from users.models import VCodeModel


@admin.register(VCodeModel)
class VCodeModelAdmin(Parent):
    list_display = [
        'user',
        'expiry_datetime',
    ]
    list_display_links = [
        'user',
        'expiry_datetime',
    ]
    fieldsets = [
        (_('Info'), {
            'fields': [
                'user',
                'hashed_code',
                'expiry_datetime',
            ]}),
    ]

    def has_delete_permission(self, request, obj=None):
        return False

    def has_change_permission(self, request, obj=None):
        return False

    def has_add_permission(self, request):
        return False
