aboutsummaryrefslogtreecommitdiffstats
path: root/routes/heroes.py
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2022-03-26 04:08:43 +0800
committerJesús <heckyel@hyperbola.info>2022-03-26 04:08:43 +0800
commit504f7cd8d0d6cebc5fccc87f1d2eeed17a414c72 (patch)
tree3af870342b3b7e17d5e0e89fd0f8984407d8f43c /routes/heroes.py
parentb99100b64dd7646c7079455908b161814b5494a2 (diff)
downloadheroeapi-504f7cd8d0d6cebc5fccc87f1d2eeed17a414c72.tar.lz
heroeapi-504f7cd8d0d6cebc5fccc87f1d2eeed17a414c72.tar.xz
heroeapi-504f7cd8d0d6cebc5fccc87f1d2eeed17a414c72.zip
Capitalize each Word in a String in Heroe name
Diffstat (limited to 'routes/heroes.py')
-rw-r--r--routes/heroes.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/routes/heroes.py b/routes/heroes.py
index 9b631a5..ab1b0ba 100644
--- a/routes/heroes.py
+++ b/routes/heroes.py
@@ -36,6 +36,7 @@ from utils.errors import (
not_data_found
)
from utils.decorators import superuser
+from utils.strings import capitalize_each
from bson.objectid import ObjectId
heroes = Blueprint("heroes", __name__)
@@ -86,7 +87,7 @@ def create_heroe():
url=request.json['image']['url']
)
heroe = HeroeModel(
- name=request.json['name'].capitalize(),
+ name=capitalize_each(request.json['name']),
powerstats=powerstats,
biography=biography,
appearance=appearance,
@@ -318,7 +319,7 @@ def get_image_heroe(id):
def get_some_heroe_name(name):
"""Search heroe by name"""
try:
- name = name.capitalize()
+ name = capitalize_each(name)
heroe = HeroeModel.objects.filter(name=name)
if len(heroe) > 0:
data = heroe.exclude('added_by').to_json()
@@ -407,7 +408,7 @@ def put_heroe(id):
url=request.json['image']['url']
)
heroe.update(
- name=request.json['name'].capitalize(),
+ name=capitalize_each(request.json['name']),
powerstats=powerstats,
biography=biography,
appearance=appearance,