From de40a40f61f66ed415a8bd9d6b9a7728927c71e3 Mon Sep 17 00:00:00 2001 From: Justin Reeves Date: Wed, 11 Jan 2023 22:43:11 -0500 Subject: [PATCH 1/3] patch(endpoints): fix if-statement in tag post route for 24 files --- .../07_sqlalchemy_many_to_many/02_one_to_many_review/README.md | 2 +- .../02_one_to_many_review/end/resources/tag.py | 2 +- .../03_many_to_many_relationships/README.md | 2 +- .../03_many_to_many_relationships/end/resources/tag.py | 2 +- .../03_many_to_many_relationships/start/resources/tag.py | 2 +- .../04_flask_jwt_extended_setup/end/resources/tag.py | 2 +- .../04_flask_jwt_extended_setup/start/resources/tag.py | 2 +- .../05_user_model_and_schema/end/resources/tag.py | 2 +- .../05_user_model_and_schema/start/resources/tag.py | 2 +- .../06_registering_users_rest_api/end/resources/tag.py | 2 +- .../06_registering_users_rest_api/start/resources/tag.py | 2 +- .../07_login_users_rest_api/end/resources/tag.py | 2 +- .../07_login_users_rest_api/start/resources/tag.py | 2 +- .../end/resources/tag.py | 3 +-- .../start/resources/tag.py | 2 +- .../09_jwt_claims_and_authorization/end/resources/tag.py | 2 +- .../09_jwt_claims_and_authorization/start/resources/tag.py | 2 +- .../10_logout_users_rest_api/end/resources/tag.py | 2 +- .../10_logout_users_rest_api/start/resources/tag.py | 2 +- .../end/resources/tag.py | 2 +- .../start/resources/tag.py | 2 +- project/05-add-many-to-many/resources/tag.py | 2 +- project/06-add-db-migrations/resources/tag.py | 2 +- 23 files changed, 23 insertions(+), 24 deletions(-) diff --git a/docs/docs/07_sqlalchemy_many_to_many/02_one_to_many_review/README.md b/docs/docs/07_sqlalchemy_many_to_many/02_one_to_many_review/README.md index 3e25e4c1..8239fa08 100644 --- a/docs/docs/07_sqlalchemy_many_to_many/02_one_to_many_review/README.md +++ b/docs/docs/07_sqlalchemy_many_to_many/02_one_to_many_review/README.md @@ -117,7 +117,7 @@ class TagsInStore(MethodView): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/07_sqlalchemy_many_to_many/02_one_to_many_review/end/resources/tag.py b/docs/docs/07_sqlalchemy_many_to_many/02_one_to_many_review/end/resources/tag.py index 593d6e4a..66548593 100644 --- a/docs/docs/07_sqlalchemy_many_to_many/02_one_to_many_review/end/resources/tag.py +++ b/docs/docs/07_sqlalchemy_many_to_many/02_one_to_many_review/end/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/README.md b/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/README.md index 4171bb03..61508c55 100644 --- a/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/README.md +++ b/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/README.md @@ -190,7 +190,7 @@ class TagsInStore(MethodView): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/end/resources/tag.py b/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/end/resources/tag.py index d42ee548..b2450fe5 100644 --- a/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/end/resources/tag.py +++ b/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/end/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/start/resources/tag.py b/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/start/resources/tag.py index 593d6e4a..66548593 100644 --- a/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/start/resources/tag.py +++ b/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/start/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/end/resources/tag.py b/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/end/resources/tag.py index d42ee548..b2450fe5 100644 --- a/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/end/resources/tag.py +++ b/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/end/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/start/resources/tag.py b/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/start/resources/tag.py index d42ee548..b2450fe5 100644 --- a/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/start/resources/tag.py +++ b/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/start/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/08_flask_jwt_extended/05_user_model_and_schema/end/resources/tag.py b/docs/docs/08_flask_jwt_extended/05_user_model_and_schema/end/resources/tag.py index d42ee548..b2450fe5 100644 --- a/docs/docs/08_flask_jwt_extended/05_user_model_and_schema/end/resources/tag.py +++ b/docs/docs/08_flask_jwt_extended/05_user_model_and_schema/end/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/08_flask_jwt_extended/05_user_model_and_schema/start/resources/tag.py b/docs/docs/08_flask_jwt_extended/05_user_model_and_schema/start/resources/tag.py index d42ee548..b2450fe5 100644 --- a/docs/docs/08_flask_jwt_extended/05_user_model_and_schema/start/resources/tag.py +++ b/docs/docs/08_flask_jwt_extended/05_user_model_and_schema/start/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/08_flask_jwt_extended/06_registering_users_rest_api/end/resources/tag.py b/docs/docs/08_flask_jwt_extended/06_registering_users_rest_api/end/resources/tag.py index d42ee548..b2450fe5 100644 --- a/docs/docs/08_flask_jwt_extended/06_registering_users_rest_api/end/resources/tag.py +++ b/docs/docs/08_flask_jwt_extended/06_registering_users_rest_api/end/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/08_flask_jwt_extended/06_registering_users_rest_api/start/resources/tag.py b/docs/docs/08_flask_jwt_extended/06_registering_users_rest_api/start/resources/tag.py index d42ee548..b2450fe5 100644 --- a/docs/docs/08_flask_jwt_extended/06_registering_users_rest_api/start/resources/tag.py +++ b/docs/docs/08_flask_jwt_extended/06_registering_users_rest_api/start/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/08_flask_jwt_extended/07_login_users_rest_api/end/resources/tag.py b/docs/docs/08_flask_jwt_extended/07_login_users_rest_api/end/resources/tag.py index d42ee548..b2450fe5 100644 --- a/docs/docs/08_flask_jwt_extended/07_login_users_rest_api/end/resources/tag.py +++ b/docs/docs/08_flask_jwt_extended/07_login_users_rest_api/end/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/08_flask_jwt_extended/07_login_users_rest_api/start/resources/tag.py b/docs/docs/08_flask_jwt_extended/07_login_users_rest_api/start/resources/tag.py index d42ee548..b2450fe5 100644 --- a/docs/docs/08_flask_jwt_extended/07_login_users_rest_api/start/resources/tag.py +++ b/docs/docs/08_flask_jwt_extended/07_login_users_rest_api/start/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/08_flask_jwt_extended/08_protect_resources_with_jwt_required/end/resources/tag.py b/docs/docs/08_flask_jwt_extended/08_protect_resources_with_jwt_required/end/resources/tag.py index d42ee548..71142e50 100644 --- a/docs/docs/08_flask_jwt_extended/08_protect_resources_with_jwt_required/end/resources/tag.py +++ b/docs/docs/08_flask_jwt_extended/08_protect_resources_with_jwt_required/end/resources/tag.py @@ -20,9 +20,8 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") - tag = TagModel(**tag_data, store_id=store_id) try: diff --git a/docs/docs/08_flask_jwt_extended/08_protect_resources_with_jwt_required/start/resources/tag.py b/docs/docs/08_flask_jwt_extended/08_protect_resources_with_jwt_required/start/resources/tag.py index d42ee548..b2450fe5 100644 --- a/docs/docs/08_flask_jwt_extended/08_protect_resources_with_jwt_required/start/resources/tag.py +++ b/docs/docs/08_flask_jwt_extended/08_protect_resources_with_jwt_required/start/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/08_flask_jwt_extended/09_jwt_claims_and_authorization/end/resources/tag.py b/docs/docs/08_flask_jwt_extended/09_jwt_claims_and_authorization/end/resources/tag.py index d42ee548..b2450fe5 100644 --- a/docs/docs/08_flask_jwt_extended/09_jwt_claims_and_authorization/end/resources/tag.py +++ b/docs/docs/08_flask_jwt_extended/09_jwt_claims_and_authorization/end/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/08_flask_jwt_extended/09_jwt_claims_and_authorization/start/resources/tag.py b/docs/docs/08_flask_jwt_extended/09_jwt_claims_and_authorization/start/resources/tag.py index d42ee548..b2450fe5 100644 --- a/docs/docs/08_flask_jwt_extended/09_jwt_claims_and_authorization/start/resources/tag.py +++ b/docs/docs/08_flask_jwt_extended/09_jwt_claims_and_authorization/start/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/08_flask_jwt_extended/10_logout_users_rest_api/end/resources/tag.py b/docs/docs/08_flask_jwt_extended/10_logout_users_rest_api/end/resources/tag.py index d42ee548..b2450fe5 100644 --- a/docs/docs/08_flask_jwt_extended/10_logout_users_rest_api/end/resources/tag.py +++ b/docs/docs/08_flask_jwt_extended/10_logout_users_rest_api/end/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/08_flask_jwt_extended/10_logout_users_rest_api/start/resources/tag.py b/docs/docs/08_flask_jwt_extended/10_logout_users_rest_api/start/resources/tag.py index d42ee548..b2450fe5 100644 --- a/docs/docs/08_flask_jwt_extended/10_logout_users_rest_api/start/resources/tag.py +++ b/docs/docs/08_flask_jwt_extended/10_logout_users_rest_api/start/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/08_flask_jwt_extended/12_token_refreshing_flask_jwt_extended/end/resources/tag.py b/docs/docs/08_flask_jwt_extended/12_token_refreshing_flask_jwt_extended/end/resources/tag.py index d42ee548..b2450fe5 100644 --- a/docs/docs/08_flask_jwt_extended/12_token_refreshing_flask_jwt_extended/end/resources/tag.py +++ b/docs/docs/08_flask_jwt_extended/12_token_refreshing_flask_jwt_extended/end/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/docs/docs/08_flask_jwt_extended/12_token_refreshing_flask_jwt_extended/start/resources/tag.py b/docs/docs/08_flask_jwt_extended/12_token_refreshing_flask_jwt_extended/start/resources/tag.py index d42ee548..b2450fe5 100644 --- a/docs/docs/08_flask_jwt_extended/12_token_refreshing_flask_jwt_extended/start/resources/tag.py +++ b/docs/docs/08_flask_jwt_extended/12_token_refreshing_flask_jwt_extended/start/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/project/05-add-many-to-many/resources/tag.py b/project/05-add-many-to-many/resources/tag.py index d42ee548..b2450fe5 100644 --- a/project/05-add-many-to-many/resources/tag.py +++ b/project/05-add-many-to-many/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) diff --git a/project/06-add-db-migrations/resources/tag.py b/project/06-add-db-migrations/resources/tag.py index d42ee548..b2450fe5 100644 --- a/project/06-add-db-migrations/resources/tag.py +++ b/project/06-add-db-migrations/resources/tag.py @@ -20,7 +20,7 @@ def get(self, store_id): @blp.arguments(TagSchema) @blp.response(201, TagSchema) def post(self, tag_data, store_id): - if TagModel.query.filter(TagModel.store_id == store_id).first(): + if TagModel.query.filter(TagModel.store_id == store_id, TagModel.name == tag_data["name"]).first(): abort(400, message="A tag with that name already exists in that store.") tag = TagModel(**tag_data, store_id=store_id) From 9674a8fde7c05c2be757fc7cd9beb90274d73ffc Mon Sep 17 00:00:00 2001 From: Justin Reeves Date: Thu, 12 Jan 2023 10:12:10 -0500 Subject: [PATCH 2/3] patch(models): change Tag name column to unique = False in 39 files --- .../02_one_to_many_review/README.md | 2 +- .../02_one_to_many_review/end/models/tag.py | 2 +- .../03_many_to_many_relationships/README.md | 2 +- .../03_many_to_many_relationships/end/models/tag.py | 2 +- .../03_many_to_many_relationships/start/models/tag.py | 2 +- .../04_flask_jwt_extended_setup/end/models/tag.py | 5 +++-- .../04_flask_jwt_extended_setup/start/models/tag.py | 5 +++-- .../05_user_model_and_schema/end/models/tag.py | 5 +++-- .../05_user_model_and_schema/start/models/tag.py | 2 +- .../06_registering_users_rest_api/end/models/tag.py | 2 +- .../06_registering_users_rest_api/start/models/tag.py | 2 +- .../07_login_users_rest_api/end/models/tag.py | 2 +- .../07_login_users_rest_api/start/models/tag.py | 2 +- .../08_protect_resources_with_jwt_required/end/models/tag.py | 2 +- .../start/models/tag.py | 5 +++-- .../09_jwt_claims_and_authorization/end/models/tag.py | 2 +- .../09_jwt_claims_and_authorization/start/models/tag.py | 2 +- .../10_logout_users_rest_api/end/models/tag.py | 2 +- .../10_logout_users_rest_api/start/models/tag.py | 2 +- .../12_token_refreshing_flask_jwt_extended/end/models/tag.py | 2 +- .../start/models/tag.py | 2 +- .../05_environment_variables_and_migrations/README.md | 2 +- .../01_send_emails_python_mailgun/end/models/tag.py | 2 +- .../01_send_emails_python_mailgun/start/models/tag.py | 2 +- .../02_send_email_user_registration/end/models/tag.py | 2 +- .../02_send_email_user_registration/start/models/tag.py | 2 +- .../04_populate_rq_task_queue/end/models/tag.py | 2 +- .../04_populate_rq_task_queue/start/models/tag.py | 2 +- .../05_rq_background_worker/end/models/tag.py | 2 +- .../05_rq_background_worker/start/models/tag.py | 2 +- .../06_sending_html_emails/end/models/tag.py | 2 +- .../06_sending_html_emails/start/models/tag.py | 2 +- .../07_deploy_background_worker_render/end/models/tag.py | 2 +- .../07_deploy_background_worker_render/start/models/tag.py | 2 +- project/05-add-many-to-many/models/tag.py | 2 +- project/06-add-db-migrations/models/tag.py | 2 +- project/using-flask-restful/models/tag.py | 2 +- project/using-flask-restx/models/tag.py | 2 +- project/using-flask-smorest/models/tag.py | 2 +- 39 files changed, 47 insertions(+), 43 deletions(-) diff --git a/docs/docs/07_sqlalchemy_many_to_many/02_one_to_many_review/README.md b/docs/docs/07_sqlalchemy_many_to_many/02_one_to_many_review/README.md index 8239fa08..d6bcc9e0 100644 --- a/docs/docs/07_sqlalchemy_many_to_many/02_one_to_many_review/README.md +++ b/docs/docs/07_sqlalchemy_many_to_many/02_one_to_many_review/README.md @@ -24,7 +24,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/07_sqlalchemy_many_to_many/02_one_to_many_review/end/models/tag.py b/docs/docs/07_sqlalchemy_many_to_many/02_one_to_many_review/end/models/tag.py index 0bab33a9..2a395c23 100644 --- a/docs/docs/07_sqlalchemy_many_to_many/02_one_to_many_review/end/models/tag.py +++ b/docs/docs/07_sqlalchemy_many_to_many/02_one_to_many_review/end/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/README.md b/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/README.md index 61508c55..5786ac8c 100644 --- a/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/README.md +++ b/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/README.md @@ -84,7 +84,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/end/models/tag.py b/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/end/models/tag.py index 5e92c9fa..32103cb1 100644 --- a/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/end/models/tag.py +++ b/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/end/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/start/models/tag.py b/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/start/models/tag.py index 0bab33a9..2a395c23 100644 --- a/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/start/models/tag.py +++ b/docs/docs/07_sqlalchemy_many_to_many/03_many_to_many_relationships/start/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/end/models/tag.py b/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/end/models/tag.py index 5e92c9fa..f65023bd 100644 --- a/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/end/models/tag.py +++ b/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/end/models/tag.py @@ -5,8 +5,9 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") - items = db.relationship("ItemModel", back_populates="tags", secondary="items_tags") + items = db.relationship( + "ItemModel", back_populates="tags", secondary="items_tags") diff --git a/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/start/models/tag.py b/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/start/models/tag.py index 5e92c9fa..f65023bd 100644 --- a/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/start/models/tag.py +++ b/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/start/models/tag.py @@ -5,8 +5,9 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") - items = db.relationship("ItemModel", back_populates="tags", secondary="items_tags") + items = db.relationship( + "ItemModel", back_populates="tags", secondary="items_tags") diff --git a/docs/docs/08_flask_jwt_extended/05_user_model_and_schema/end/models/tag.py b/docs/docs/08_flask_jwt_extended/05_user_model_and_schema/end/models/tag.py index 5e92c9fa..f65023bd 100644 --- a/docs/docs/08_flask_jwt_extended/05_user_model_and_schema/end/models/tag.py +++ b/docs/docs/08_flask_jwt_extended/05_user_model_and_schema/end/models/tag.py @@ -5,8 +5,9 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") - items = db.relationship("ItemModel", back_populates="tags", secondary="items_tags") + items = db.relationship( + "ItemModel", back_populates="tags", secondary="items_tags") diff --git a/docs/docs/08_flask_jwt_extended/05_user_model_and_schema/start/models/tag.py b/docs/docs/08_flask_jwt_extended/05_user_model_and_schema/start/models/tag.py index 5e92c9fa..32103cb1 100644 --- a/docs/docs/08_flask_jwt_extended/05_user_model_and_schema/start/models/tag.py +++ b/docs/docs/08_flask_jwt_extended/05_user_model_and_schema/start/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/08_flask_jwt_extended/06_registering_users_rest_api/end/models/tag.py b/docs/docs/08_flask_jwt_extended/06_registering_users_rest_api/end/models/tag.py index 5e92c9fa..32103cb1 100644 --- a/docs/docs/08_flask_jwt_extended/06_registering_users_rest_api/end/models/tag.py +++ b/docs/docs/08_flask_jwt_extended/06_registering_users_rest_api/end/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/08_flask_jwt_extended/06_registering_users_rest_api/start/models/tag.py b/docs/docs/08_flask_jwt_extended/06_registering_users_rest_api/start/models/tag.py index 5e92c9fa..32103cb1 100644 --- a/docs/docs/08_flask_jwt_extended/06_registering_users_rest_api/start/models/tag.py +++ b/docs/docs/08_flask_jwt_extended/06_registering_users_rest_api/start/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/08_flask_jwt_extended/07_login_users_rest_api/end/models/tag.py b/docs/docs/08_flask_jwt_extended/07_login_users_rest_api/end/models/tag.py index 5e92c9fa..32103cb1 100644 --- a/docs/docs/08_flask_jwt_extended/07_login_users_rest_api/end/models/tag.py +++ b/docs/docs/08_flask_jwt_extended/07_login_users_rest_api/end/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/08_flask_jwt_extended/07_login_users_rest_api/start/models/tag.py b/docs/docs/08_flask_jwt_extended/07_login_users_rest_api/start/models/tag.py index 5e92c9fa..32103cb1 100644 --- a/docs/docs/08_flask_jwt_extended/07_login_users_rest_api/start/models/tag.py +++ b/docs/docs/08_flask_jwt_extended/07_login_users_rest_api/start/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/08_flask_jwt_extended/08_protect_resources_with_jwt_required/end/models/tag.py b/docs/docs/08_flask_jwt_extended/08_protect_resources_with_jwt_required/end/models/tag.py index 5e92c9fa..32103cb1 100644 --- a/docs/docs/08_flask_jwt_extended/08_protect_resources_with_jwt_required/end/models/tag.py +++ b/docs/docs/08_flask_jwt_extended/08_protect_resources_with_jwt_required/end/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/08_flask_jwt_extended/08_protect_resources_with_jwt_required/start/models/tag.py b/docs/docs/08_flask_jwt_extended/08_protect_resources_with_jwt_required/start/models/tag.py index 5e92c9fa..f65023bd 100644 --- a/docs/docs/08_flask_jwt_extended/08_protect_resources_with_jwt_required/start/models/tag.py +++ b/docs/docs/08_flask_jwt_extended/08_protect_resources_with_jwt_required/start/models/tag.py @@ -5,8 +5,9 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") - items = db.relationship("ItemModel", back_populates="tags", secondary="items_tags") + items = db.relationship( + "ItemModel", back_populates="tags", secondary="items_tags") diff --git a/docs/docs/08_flask_jwt_extended/09_jwt_claims_and_authorization/end/models/tag.py b/docs/docs/08_flask_jwt_extended/09_jwt_claims_and_authorization/end/models/tag.py index 5e92c9fa..32103cb1 100644 --- a/docs/docs/08_flask_jwt_extended/09_jwt_claims_and_authorization/end/models/tag.py +++ b/docs/docs/08_flask_jwt_extended/09_jwt_claims_and_authorization/end/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/08_flask_jwt_extended/09_jwt_claims_and_authorization/start/models/tag.py b/docs/docs/08_flask_jwt_extended/09_jwt_claims_and_authorization/start/models/tag.py index 5e92c9fa..32103cb1 100644 --- a/docs/docs/08_flask_jwt_extended/09_jwt_claims_and_authorization/start/models/tag.py +++ b/docs/docs/08_flask_jwt_extended/09_jwt_claims_and_authorization/start/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/08_flask_jwt_extended/10_logout_users_rest_api/end/models/tag.py b/docs/docs/08_flask_jwt_extended/10_logout_users_rest_api/end/models/tag.py index 5e92c9fa..32103cb1 100644 --- a/docs/docs/08_flask_jwt_extended/10_logout_users_rest_api/end/models/tag.py +++ b/docs/docs/08_flask_jwt_extended/10_logout_users_rest_api/end/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/08_flask_jwt_extended/10_logout_users_rest_api/start/models/tag.py b/docs/docs/08_flask_jwt_extended/10_logout_users_rest_api/start/models/tag.py index 5e92c9fa..32103cb1 100644 --- a/docs/docs/08_flask_jwt_extended/10_logout_users_rest_api/start/models/tag.py +++ b/docs/docs/08_flask_jwt_extended/10_logout_users_rest_api/start/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/08_flask_jwt_extended/12_token_refreshing_flask_jwt_extended/end/models/tag.py b/docs/docs/08_flask_jwt_extended/12_token_refreshing_flask_jwt_extended/end/models/tag.py index 5e92c9fa..32103cb1 100644 --- a/docs/docs/08_flask_jwt_extended/12_token_refreshing_flask_jwt_extended/end/models/tag.py +++ b/docs/docs/08_flask_jwt_extended/12_token_refreshing_flask_jwt_extended/end/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/08_flask_jwt_extended/12_token_refreshing_flask_jwt_extended/start/models/tag.py b/docs/docs/08_flask_jwt_extended/12_token_refreshing_flask_jwt_extended/start/models/tag.py index 5e92c9fa..32103cb1 100644 --- a/docs/docs/08_flask_jwt_extended/12_token_refreshing_flask_jwt_extended/start/models/tag.py +++ b/docs/docs/08_flask_jwt_extended/12_token_refreshing_flask_jwt_extended/start/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/11_deploy_to_render/05_environment_variables_and_migrations/README.md b/docs/docs/11_deploy_to_render/05_environment_variables_and_migrations/README.md index 97703a93..b73aaf85 100644 --- a/docs/docs/11_deploy_to_render/05_environment_variables_and_migrations/README.md +++ b/docs/docs/11_deploy_to_render/05_environment_variables_and_migrations/README.md @@ -135,7 +135,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) # highlight-start store_id = db.Column(db.Integer, db.ForeignKey("stores.id"), nullable=False) # highlight-end diff --git a/docs/docs/12_task_queues_emails/01_send_emails_python_mailgun/end/models/tag.py b/docs/docs/12_task_queues_emails/01_send_emails_python_mailgun/end/models/tag.py index 008e8d37..37b8ed85 100644 --- a/docs/docs/12_task_queues_emails/01_send_emails_python_mailgun/end/models/tag.py +++ b/docs/docs/12_task_queues_emails/01_send_emails_python_mailgun/end/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer, db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/12_task_queues_emails/01_send_emails_python_mailgun/start/models/tag.py b/docs/docs/12_task_queues_emails/01_send_emails_python_mailgun/start/models/tag.py index 008e8d37..37b8ed85 100644 --- a/docs/docs/12_task_queues_emails/01_send_emails_python_mailgun/start/models/tag.py +++ b/docs/docs/12_task_queues_emails/01_send_emails_python_mailgun/start/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer, db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/12_task_queues_emails/02_send_email_user_registration/end/models/tag.py b/docs/docs/12_task_queues_emails/02_send_email_user_registration/end/models/tag.py index 008e8d37..37b8ed85 100644 --- a/docs/docs/12_task_queues_emails/02_send_email_user_registration/end/models/tag.py +++ b/docs/docs/12_task_queues_emails/02_send_email_user_registration/end/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer, db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/12_task_queues_emails/02_send_email_user_registration/start/models/tag.py b/docs/docs/12_task_queues_emails/02_send_email_user_registration/start/models/tag.py index 008e8d37..37b8ed85 100644 --- a/docs/docs/12_task_queues_emails/02_send_email_user_registration/start/models/tag.py +++ b/docs/docs/12_task_queues_emails/02_send_email_user_registration/start/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer, db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/12_task_queues_emails/04_populate_rq_task_queue/end/models/tag.py b/docs/docs/12_task_queues_emails/04_populate_rq_task_queue/end/models/tag.py index 008e8d37..37b8ed85 100644 --- a/docs/docs/12_task_queues_emails/04_populate_rq_task_queue/end/models/tag.py +++ b/docs/docs/12_task_queues_emails/04_populate_rq_task_queue/end/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer, db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/12_task_queues_emails/04_populate_rq_task_queue/start/models/tag.py b/docs/docs/12_task_queues_emails/04_populate_rq_task_queue/start/models/tag.py index 008e8d37..37b8ed85 100644 --- a/docs/docs/12_task_queues_emails/04_populate_rq_task_queue/start/models/tag.py +++ b/docs/docs/12_task_queues_emails/04_populate_rq_task_queue/start/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer, db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/12_task_queues_emails/05_rq_background_worker/end/models/tag.py b/docs/docs/12_task_queues_emails/05_rq_background_worker/end/models/tag.py index 008e8d37..37b8ed85 100644 --- a/docs/docs/12_task_queues_emails/05_rq_background_worker/end/models/tag.py +++ b/docs/docs/12_task_queues_emails/05_rq_background_worker/end/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer, db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/12_task_queues_emails/05_rq_background_worker/start/models/tag.py b/docs/docs/12_task_queues_emails/05_rq_background_worker/start/models/tag.py index 008e8d37..37b8ed85 100644 --- a/docs/docs/12_task_queues_emails/05_rq_background_worker/start/models/tag.py +++ b/docs/docs/12_task_queues_emails/05_rq_background_worker/start/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer, db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/12_task_queues_emails/06_sending_html_emails/end/models/tag.py b/docs/docs/12_task_queues_emails/06_sending_html_emails/end/models/tag.py index 008e8d37..37b8ed85 100644 --- a/docs/docs/12_task_queues_emails/06_sending_html_emails/end/models/tag.py +++ b/docs/docs/12_task_queues_emails/06_sending_html_emails/end/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer, db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/12_task_queues_emails/06_sending_html_emails/start/models/tag.py b/docs/docs/12_task_queues_emails/06_sending_html_emails/start/models/tag.py index 008e8d37..37b8ed85 100644 --- a/docs/docs/12_task_queues_emails/06_sending_html_emails/start/models/tag.py +++ b/docs/docs/12_task_queues_emails/06_sending_html_emails/start/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer, db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/12_task_queues_emails/07_deploy_background_worker_render/end/models/tag.py b/docs/docs/12_task_queues_emails/07_deploy_background_worker_render/end/models/tag.py index 008e8d37..37b8ed85 100644 --- a/docs/docs/12_task_queues_emails/07_deploy_background_worker_render/end/models/tag.py +++ b/docs/docs/12_task_queues_emails/07_deploy_background_worker_render/end/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer, db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/docs/docs/12_task_queues_emails/07_deploy_background_worker_render/start/models/tag.py b/docs/docs/12_task_queues_emails/07_deploy_background_worker_render/start/models/tag.py index 008e8d37..37b8ed85 100644 --- a/docs/docs/12_task_queues_emails/07_deploy_background_worker_render/start/models/tag.py +++ b/docs/docs/12_task_queues_emails/07_deploy_background_worker_render/start/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer, db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/project/05-add-many-to-many/models/tag.py b/project/05-add-many-to-many/models/tag.py index 5e92c9fa..32103cb1 100644 --- a/project/05-add-many-to-many/models/tag.py +++ b/project/05-add-many-to-many/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/project/06-add-db-migrations/models/tag.py b/project/06-add-db-migrations/models/tag.py index 5e92c9fa..32103cb1 100644 --- a/project/06-add-db-migrations/models/tag.py +++ b/project/06-add-db-migrations/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) store_id = db.Column(db.Integer(), db.ForeignKey("stores.id"), nullable=False) store = db.relationship("StoreModel", back_populates="tags") diff --git a/project/using-flask-restful/models/tag.py b/project/using-flask-restful/models/tag.py index 23332527..6f5a1bcf 100644 --- a/project/using-flask-restful/models/tag.py +++ b/project/using-flask-restful/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) items = db.relationship("ItemModel", back_populates="tags", secondary="items_tags") def json(self): diff --git a/project/using-flask-restx/models/tag.py b/project/using-flask-restx/models/tag.py index 23332527..6f5a1bcf 100644 --- a/project/using-flask-restx/models/tag.py +++ b/project/using-flask-restx/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) items = db.relationship("ItemModel", back_populates="tags", secondary="items_tags") def json(self): diff --git a/project/using-flask-smorest/models/tag.py b/project/using-flask-smorest/models/tag.py index 23332527..6f5a1bcf 100644 --- a/project/using-flask-smorest/models/tag.py +++ b/project/using-flask-smorest/models/tag.py @@ -5,7 +5,7 @@ class TagModel(db.Model): __tablename__ = "tags" id = db.Column(db.Integer, primary_key=True) - name = db.Column(db.String(80), unique=True, nullable=False) + name = db.Column(db.String(80), unique=False, nullable=False) items = db.relationship("ItemModel", back_populates="tags", secondary="items_tags") def json(self): From d16c03a682e01a8920ede65bb4ce14cae1fd5cbb Mon Sep 17 00:00:00 2001 From: Jose Salvatierra Date: Fri, 13 Jan 2023 16:18:38 +0000 Subject: [PATCH 3/3] bug(secrets): add str() call to generate secret --- .../08_flask_jwt_extended/04_flask_jwt_extended_setup/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/README.md b/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/README.md index 510ca1c4..1f56f327 100644 --- a/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/README.md +++ b/docs/docs/08_flask_jwt_extended/04_flask_jwt_extended_setup/README.md @@ -66,5 +66,5 @@ def create_app(db_url=None): :::caution The secret key set here, `"jose"`, is **not very safe**. -Instead you should generate a long and random secret key using something like `secrets.SystemRandom().getrandbits(128)`. +Instead you should generate a long and random secret key using something like `str(secrets.SystemRandom().getrandbits(128))`. :::