from django.contrib import admin
from django.core.mail import send_mail
from django.contrib import messages

from django.contrib.auth.admin import UserAdmin

# Register your models here.

from siemensusers.models import SiemensUser
from siemensusers.forms import SiemensUserCreationForm, SiemensUserChangeForm

class SiemensUserAdmin(UserAdmin):
    add_form = SiemensUserCreationForm
    form = SiemensUserChangeForm
    model = SiemensUser
    list_display = ("email", "nombre", "is_staff", "is_active", "foto")
    list_filter = ("email", "nombre", "is_staff", "is_active",)
    fieldsets = (
        (None, {"fields": ("email", "password")}),
        ("Personal", {"fields": ("nombre",)}),
        ("Permissions", {"fields": ("is_staff", "is_active", "groups",
                                    "user_permissions")}),
        ("Varios", {"fields": ("foto",)}),
    )
    add_fieldsets = (
        (
            None,
            {
                "classes": ("wide",),
                "fields": (
                    "email", "password1", "password2", "is_staff",
                    "is_active", "groups", "user_permissions"
                )
            }
        ),

        ("Personal", {"fields": ("nombre",)}),
        ("Varios", {"fields": ("foto",)}),
    )
    search_fields = ("email", "nombre",)
    ordering = ("email",)

admin.site.register(SiemensUser, SiemensUserAdmin)
