Fix: Regime was stripping the whitespaces from header
This commit is contained in:
parent
7d0874093c
commit
0f1660ef5a
@ -24,7 +24,7 @@ def save(
|
||||
try:
|
||||
with SessionFuture() as db:
|
||||
regime_id = db.execute(select(func.coalesce(func.max(Regime.id), 0) + 1)).scalar_one()
|
||||
item = Regime(id=regime_id, name=data.name, header=data.header, prefix=data.prefix)
|
||||
item = Regime(id=regime_id, name=data.name.strip(), header=data.header, prefix=data.prefix.strip())
|
||||
db.add(item)
|
||||
db.commit()
|
||||
return regime_info(item)
|
||||
@ -49,9 +49,9 @@ def update_route(
|
||||
status_code=status.HTTP_423_LOCKED,
|
||||
detail=f"{item.name} is a fixture and cannot be edited or deleted.",
|
||||
)
|
||||
item.name = data.name
|
||||
item.name = data.name.strip()
|
||||
item.header = data.header
|
||||
item.prefix = data.prefix
|
||||
item.prefix = data.prefix.strip()
|
||||
db.commit()
|
||||
return regime_info(item)
|
||||
except SQLAlchemyError as e:
|
||||
|
@ -10,7 +10,6 @@ class RegimeIn(BaseModel):
|
||||
is_fixture: bool
|
||||
|
||||
class Config:
|
||||
anystr_strip_whitespace = True
|
||||
alias_generator = to_camel
|
||||
|
||||
|
||||
@ -18,7 +17,6 @@ class Regime(RegimeIn):
|
||||
id_: int
|
||||
|
||||
class Config:
|
||||
anystr_strip_whitespace = True
|
||||
alias_generator = to_camel
|
||||
|
||||
|
||||
@ -28,7 +26,6 @@ class RegimeBlank(RegimeIn):
|
||||
prefix: str
|
||||
|
||||
class Config:
|
||||
anystr_strip_whitespace = True
|
||||
alias_generator = to_camel
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
<div class="flex flex-row justify-around content-start items-start">
|
||||
<mat-form-field class="flex-auto">
|
||||
<mat-label>Header</mat-label>
|
||||
<input matInput formControlName="header" />
|
||||
<textarea matInput formControlName="header"></textarea>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="flex flex-row justify-around content-start items-start">
|
||||
|
Loading…
Reference in New Issue
Block a user