2017-11-11 22:27:42 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from django.contrib import admin
|
|
|
|
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
2023-02-06 14:59:57 +00:00
|
|
|
from django.contrib.auth import get_user_model
|
2019-04-14 04:50:35 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2017-11-11 22:27:42 +00:00
|
|
|
|
|
|
|
from babybuddy import models
|
|
|
|
|
|
|
|
|
|
|
|
class SettingsInline(admin.StackedInline):
|
|
|
|
model = models.Settings
|
2022-02-10 00:00:30 +00:00
|
|
|
verbose_name = _("Settings")
|
|
|
|
verbose_name_plural = _("Settings")
|
2017-11-11 22:27:42 +00:00
|
|
|
can_delete = False
|
|
|
|
fieldsets = (
|
2022-02-10 00:00:30 +00:00
|
|
|
(
|
|
|
|
_("Dashboard"),
|
|
|
|
{
|
|
|
|
"fields": (
|
|
|
|
"dashboard_refresh_rate",
|
|
|
|
"dashboard_hide_empty",
|
|
|
|
"dashboard_hide_age",
|
|
|
|
)
|
|
|
|
},
|
|
|
|
),
|
2017-11-11 22:27:42 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class UserAdmin(BaseUserAdmin):
|
2022-02-10 00:00:30 +00:00
|
|
|
inlines = (SettingsInline,)
|
2017-11-11 22:27:42 +00:00
|
|
|
|
|
|
|
|
2023-02-06 14:59:57 +00:00
|
|
|
admin.site.unregister(get_user_model())
|
|
|
|
admin.site.register(get_user_model(), UserAdmin)
|