Skip to content

Commit

Permalink
[web] use ConfigDict instead of class Config
Browse files Browse the repository at this point in the history
the latter has been deprecated in pydantic v2
  • Loading branch information
lukasjuhrich committed Aug 1, 2023
1 parent fd2c028 commit 8ac9ae8
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions web/blueprints/infrastructure/tables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from flask import url_for
from flask_login import current_user
from pydantic import BaseModel

from pydantic import BaseModel, ConfigDict

from web.table.table import (
BootstrapTable,
Expand Down Expand Up @@ -31,6 +30,7 @@ class SubnetTable(BootstrapTable):


class SubnetRow(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: int
description: str | None
address: str
Expand All @@ -39,9 +39,6 @@ class SubnetRow(BaseModel):
free_ips: str # the sort name
free_ips_formatted: str

class Config:
from_attributes = True


class SwitchTable(BootstrapTable):
id = Column("#")
Expand Down Expand Up @@ -73,13 +70,11 @@ class VlanTable(BootstrapTable):


class VlanRow(BaseModel):
config = ConfigDict(from_attributes=True)
id: int
name: str
vid: int

class Config:
from_attributes = True


class PortTable(BootstrapTable):
class Meta:
Expand Down

0 comments on commit 8ac9ae8

Please sign in to comment.