From bbcabf3c7411dc39f86b85652783155c02c0a243 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Mon, 25 Sep 2017 11:09:42 +0200 Subject: [PATCH] Add YASnippets for Flask-SQLAlchemy models MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …both normal and translatable --- snippets/python-mode/flask_sqlalchemy_model | 10 ++++++++++ snippets/python-mode/translatable_model | 14 ++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 snippets/python-mode/flask_sqlalchemy_model create mode 100644 snippets/python-mode/translatable_model diff --git a/snippets/python-mode/flask_sqlalchemy_model b/snippets/python-mode/flask_sqlalchemy_model new file mode 100644 index 0000000..82fb12c --- /dev/null +++ b/snippets/python-mode/flask_sqlalchemy_model @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: flask_sqlalchemy_model +# key: model +# -- +class ${1:name}(db.Model): + __tablename__ = '${2:tablename}' + + id = db.Column(db.Integer, primary_key=True) + + $0 \ No newline at end of file diff --git a/snippets/python-mode/translatable_model b/snippets/python-mode/translatable_model new file mode 100644 index 0000000..6437999 --- /dev/null +++ b/snippets/python-mode/translatable_model @@ -0,0 +1,14 @@ +# -*- mode: snippet -*- +# name: Translatable Flask-SQLAlchemy model +# key: tmodel +# -- +class ${1:name}(Translatable, db.Model): + __tablename__ = '${2:tablename}s' + + id = db.Column(db.Integer, primary_key=True) + + +class $1Translation(translation_base($1)): + __tablename__ = '$2_translations' + + $0 \ No newline at end of file