from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from core import models
from django.utils.translation import gettext as _


# Register your models here.
class UserAdmin(BaseUserAdmin):
    ordering = ['id']
    list_display = ['email', 'name']
    fieldsets = (
        (None, {'fields': ('email', 'password')}),
        (_('Personal Info'), {'fields': ('name',)}),
        (
            _('Permissions'),
            {
                'fields': (
                    'is_active',
                    'is_staff',
                    'is_superuser',
                    )
                }
            ),
        (_('Important dates'), {'fields': ('last_login',)}),
        )
    add_fieldsets = (
        (None, {
            'classes': ('wide',),
            'fields': ('email', 'password1', 'password2')
            }),
        )


admin.site.register(models.User, UserAdmin)
admin.site.register(models.Tag)
admin.site.register(models.Ingredients)
admin.site.register(models.Recipe)




# class UserAdmin(BaseUserAdmin):
#     ordering = ['id']
#     list_display = ['email', 'name']
#     # Admin User Edit page Work. Need To set fieldsets
#     fieldsets = (
#         # None is defined for sessions
#         (None, {'fields': ('email', 'password')}),
#         (_('Personal Info'), {'fields': ('name',)}),
#         (
#             _('Permissions'),
#             {'fields': ('is_active', 'is_staff', 'is_superuser')}
#             ),
#         (
#             _('Important date'), {'fields': ('last_login',)}
#             ),  # last login information
#         )
#     # add new user
#     add_fieldsets = (
#         (None, {
#             'classes': ('wide',),
#             'fields': ('email', 'password1', 'password2'),
#             }),
#         )
#
#
# admin.site.register(models.User, UserAdmin)
