Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Make miscellaneous improvements to the API developer experience (#4387)

Dhruv Bhanushali183e6c63c6d8
diff --git a/api/api/apps.py b/api/api/apps.py
index 700d28efe..353417626 100644
--- a/api/api/apps.py
+++ b/api/api/apps.py
@@ -3,4 +3,5 @@ from django.apps import AppConfig
class ApiConfig(AppConfig):
name = "api"
+ verbose_name = "API"
default_auto_field = "django.db.models.AutoField"
diff --git a/api/api/migrations/0064_define_verbose_names.py b/api/api/migrations/0064_define_verbose_names.py
new file mode 100644
index 000000000..cb8f066df
--- /dev/null
+++ b/api/api/migrations/0064_define_verbose_names.py
@@ -0,0 +1,58 @@
+# Generated by Django 4.2.11 on 2024-05-26 11:05
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('api', '0063_merge_20240521_0843'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='audio',
+ name='creator_url',
+ field=models.TextField(blank=True, help_text='A direct link to the media creator.', max_length=2000, null=True, verbose_name='creator URL'),
+ ),
+ migrations.AlterField(
+ model_name='audio',
+ name='foreign_landing_url',
+ field=models.TextField(blank=True, help_text='The landing page of the work.', null=True, verbose_name='foreign landing URL'),
+ ),
+ migrations.AlterField(
+ model_name='audio',
+ name='url',
+ field=models.TextField(blank=True, help_text='The actual URL to the media file.', max_length=1000, null=True, unique=True, verbose_name='URL'),
+ ),
+ migrations.AlterField(
+ model_name='audioset',
+ name='creator_url',
+ field=models.TextField(blank=True, help_text='A direct link to the media creator.', max_length=2000, null=True, verbose_name='creator URL'),
+ ),
+ migrations.AlterField(
+ model_name='audioset',
+ name='foreign_landing_url',
+ field=models.TextField(blank=True, help_text='The landing page of the work.', null=True, verbose_name='foreign landing URL'),
+ ),
+ migrations.AlterField(
+ model_name='audioset',
+ name='url',
+ field=models.TextField(blank=True, help_text='The actual URL to the media file.', max_length=1000, null=True, unique=True, verbose_name='URL'),
+ ),
+ migrations.AlterField(
+ model_name='image',
+ name='creator_url',
+ field=models.TextField(blank=True, help_text='A direct link to the media creator.', max_length=2000, null=True, verbose_name='creator URL'),
+ ),
+ migrations.AlterField(
+ model_name='image',
+ name='foreign_landing_url',
+ field=models.TextField(blank=True, help_text='The landing page of the work.', null=True, verbose_name='foreign landing URL'),
+ ),
+ migrations.AlterField(
+ model_name='image',
+ name='url',
+ field=models.TextField(blank=True, help_text='The actual URL to the media file.', max_length=1000, null=True, unique=True, verbose_name='URL'),
+ ),
+ ]
diff --git a/api/api/models/mixins.py b/api/api/models/mixins.py
index e1f77a465..16adf2418 100644
--- a/api/api/models/mixins.py
+++ b/api/api/models/mixins.py
@@ -70,6 +70,7 @@ class MediaMixin(models.Model):
foreign_landing_url = models.TextField(
blank=True,
null=True,
+ verbose_name="foreign landing URL",
help_text="The landing page of the work.",
)
@@ -82,6 +83,7 @@ class MediaMixin(models.Model):
max_length=2000,
blank=True,
null=True,
+ verbose_name="creator URL",
help_text="A direct link to the media creator.",
)
@@ -123,9 +125,10 @@ class FileMixin(models.Model):
url = models.TextField(
unique=True,
max_length=1000,
- help_text="The actual URL to the media file.",
blank=True,
null=True,
+ verbose_name="URL",
+ help_text="The actual URL to the media file.",
)
filesize = models.IntegerField(
blank=True,
diff --git a/api/latest_migrations/api b/api/latest_migrations/api
index b1c2f6346..ec23aa5e2 100644
--- a/api/latest_migrations/api
+++ b/api/latest_migrations/api
@@ -2,4 +2,4 @@
# If you have a merge conflict in this file, it means you need to run:
# manage.py makemigrations --merge
# in order to resolve the conflict between migrations.
-0063_merge_20240521_0843
+0064_define_verbose_names
diff --git a/api/run.py b/api/run.py
index 0265ad680..fb025e15d 100644
--- a/api/run.py
+++ b/api/run.py
@@ -18,6 +18,8 @@ if __name__ == "__main__":
".", # default, API directory
"../packages/python/",
],
+ # Also reload Uvicorn when templates change.
+ reload_includes=["*.py", "*.html"],
log_level="debug",
access_log=False,
)