-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: management commands & migrations fix
- Add `__init__.py` under `VIM/apps` directory to fix pylint error: `No name 'apps' in module 'VIM' Pylint(E0611:no-name-in-module)`; - Adjust importing order in all management commands; - In `download_imgs.py`: (1) remove class `ImageDownloader` and place all methods into `Command` class; (2) change constants into upper case; (3) add `timeout` for `requests.get`; (4) change general `Exception` into specific exception types such as `requests.RequestException` and `IOError`; (5) change all `print()` into `self.stdout.write` and `self.stderr.write`; - In `import_instruments.py`, change relative image path into absolute path; - Recover migrations file; create an additional file for thumbnail field; Refs: #138
- Loading branch information
1 parent
be6e90f
commit c14de8a
Showing
7 changed files
with
86 additions
and
47 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
web-app/django/VIM/apps/instruments/management/commands/import_languages.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
web-app/django/VIM/apps/instruments/migrations/0002_instrument_thumbnail.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 4.2.5 on 2024-08-13 14:23 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("instruments", "0001_initial"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="instrument", | ||
name="thumbnail", | ||
field=models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.PROTECT, | ||
related_name="thumbnail_of", | ||
to="instruments.avresource", | ||
), | ||
), | ||
] |