Browse Source

Add command for untagged

master
Dashie der otter 3 years ago
parent
commit
bfb7d6b3f5
2 changed files with 17 additions and 0 deletions
  1. 9
    0
      README.md
  2. 8
    0
      stockazng.py

+ 9
- 0
README.md View File

@@ -41,3 +41,12 @@ StockazNG
- Add printing view for storage map
- Add barcodes to storage map
- Octopart integration for Parameters

# Upgrades
If stuck on "Set all parts without tags to "untagged" for tags_slug", runs :

- python stockazng.py db upgrade 2396a54ec576
- python stockazng.py db upgrade 55103a380b6c
- python stockazng.py db upgrade

And it should pass.

+ 8
- 0
stockazng.py View File

@@ -322,6 +322,14 @@ def mkdirs():
mkdir(os.path.join(app.config['UPLOADS_DEFAULT_DEST'], ii, str(i['id'])))


@manager.command
def tags_untag():
""" Set tags_slug as 'untagged' if no associated tags """
for i in Part.query.all():
if len(i.tags) <= 0:
i.tags_slug = "untagged"
db.session.commit()
manager.add_command('db', MigrateCommand)

if __name__ == '__main__':