2
2
3
3
from jinja2 import BaseLoader , ChoiceLoader , Environment , PackageLoader
4
4
from jinja2 .ext import Extension
5
- from pydantic import BaseSettings , Field , IPvAnyAddress , root_validator
6
- from pydantic .color import Color
5
+ from pydantic import Field , IPvAnyAddress , model_validator
6
+ from pydantic_extra_types .color import Color
7
+ from pydantic_settings import BaseSettings , SettingsConfigDict
7
8
8
9
9
10
class DebugToolbarSettings (BaseSettings ):
11
+ model_config = SettingsConfigDict (
12
+ title = "Debug Toolbar" ,
13
+ env_prefix = "DT_" ,
14
+ case_sensitive = False ,
15
+ )
16
+
10
17
DEFAULT_PANELS : t .List [str ] = Field (
11
18
[
12
19
"debug_toolbar.panels.versions.VersionsPanel" ,
13
20
"debug_toolbar.panels.timer.TimerPanel" ,
14
21
"debug_toolbar.panels.settings.SettingsPanel" ,
15
22
"debug_toolbar.panels.request.RequestPanel" ,
16
23
"debug_toolbar.panels.headers.HeadersPanel" ,
17
- "debug_toolbar.panels.pydantic.PydanticPanel" ,
18
24
"debug_toolbar.panels.routes.RoutesPanel" ,
19
25
"debug_toolbar.panels.logging.LoggingPanel" ,
20
26
"debug_toolbar.panels.profiling.ProfilingPanel" ,
@@ -129,11 +135,6 @@ class DebugToolbarSettings(BaseSettings):
129
135
),
130
136
)
131
137
132
- class Config :
133
- title = "Debug Toolbar"
134
- env_prefix = "DT_"
135
- case_sensitive = True
136
-
137
138
def __init__ (self , ** settings : t .Any ) -> None :
138
139
super ().__init__ (** settings )
139
140
loaders = self .JINJA_LOADERS + [PackageLoader ("debug_toolbar" , "templates" )]
@@ -144,6 +145,6 @@ def __init__(self, **settings: t.Any) -> None:
144
145
for extension in self .JINJA_EXTENSIONS :
145
146
self .JINJA_ENV .add_extension (extension )
146
147
147
- @root_validator ( pre = True )
148
- def ci (cls , values : t . Dict [ str , t . Any ]) -> t . Dict [ str , t . Any ] :
149
- return {k .upper (): v for k , v in values .items ()}
148
+ @model_validator ( mode = "before" )
149
+ def ci (cls , data : dict ) :
150
+ return {k .upper (): v for k , v in data .items ()}
0 commit comments