From d5978edd29bd64f93f132710855f4ccc16e4345b Mon Sep 17 00:00:00 2001 From: EllipticEllipsis Date: Fri, 26 Aug 2022 11:18:58 +0100 Subject: [PATCH] Some URL fields for projects (#12) * Add some URLFields to projects * null=False version --- ...cord_project_repository_project_website.py | 28 +++++++++++++++++ ...scord_alter_project_repository_and_more.py | 31 +++++++++++++++++++ frog_api/models.py | 3 ++ frog_api/serializers.py | 9 +++++- 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 frog_api/migrations/0008_project_discord_project_repository_project_website.py create mode 100644 frog_api/migrations/0009_alter_project_discord_alter_project_repository_and_more.py diff --git a/frog_api/migrations/0008_project_discord_project_repository_project_website.py b/frog_api/migrations/0008_project_discord_project_repository_project_website.py new file mode 100644 index 0000000..94d55a7 --- /dev/null +++ b/frog_api/migrations/0008_project_discord_project_repository_project_website.py @@ -0,0 +1,28 @@ +# Generated by Django 4.1 on 2022-08-26 04:40 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("frog_api", "0007_alter_entry_timestamp"), + ] + + operations = [ + migrations.AddField( + model_name="project", + name="discord", + field=models.URLField(blank=True, null=True), + ), + migrations.AddField( + model_name="project", + name="repository", + field=models.URLField(blank=True, null=True), + ), + migrations.AddField( + model_name="project", + name="website", + field=models.URLField(blank=True, null=True), + ), + ] diff --git a/frog_api/migrations/0009_alter_project_discord_alter_project_repository_and_more.py b/frog_api/migrations/0009_alter_project_discord_alter_project_repository_and_more.py new file mode 100644 index 0000000..dfb4932 --- /dev/null +++ b/frog_api/migrations/0009_alter_project_discord_alter_project_repository_and_more.py @@ -0,0 +1,31 @@ +# Generated by Django 4.1 on 2022-08-26 04:50 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("frog_api", "0008_project_discord_project_repository_project_website"), + ] + + operations = [ + migrations.AlterField( + model_name="project", + name="discord", + field=models.URLField(blank=True, default=""), + preserve_default=False, + ), + migrations.AlterField( + model_name="project", + name="repository", + field=models.URLField(blank=True, default=""), + preserve_default=False, + ), + migrations.AlterField( + model_name="project", + name="website", + field=models.URLField(blank=True, default=""), + preserve_default=False, + ), + ] diff --git a/frog_api/models.py b/frog_api/models.py index c00eb46..2cec126 100644 --- a/frog_api/models.py +++ b/frog_api/models.py @@ -22,6 +22,9 @@ class Project(models.Model): slug = models.SlugField(max_length=255, unique=True) name = models.CharField(max_length=255) auth_key = models.CharField(max_length=AUTH_KEY_LEN, default=gen_auth_key) + repository = models.URLField(blank=True) + discord = models.URLField(blank=True) + website = models.URLField(blank=True) def __str__(self) -> str: return self.slug diff --git a/frog_api/serializers.py b/frog_api/serializers.py index b94a015..75d3d15 100644 --- a/frog_api/serializers.py +++ b/frog_api/serializers.py @@ -14,7 +14,14 @@ class ProjectSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Project - fields = ["slug", "name", "versions"] + fields = [ + "slug", + "name", + "versions", + "repository", + "discord", + "website", + ] class MeasureSerializer(serializers.HyperlinkedModelSerializer):