Some URL fields for projects (#12)

* Add some URLFields to projects

* null=False version
This commit is contained in:
EllipticEllipsis 2022-08-26 11:18:58 +01:00 committed by GitHub
parent 3b62d63fbb
commit d5978edd29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 70 additions and 1 deletions

View File

@ -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),
),
]

View File

@ -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,
),
]

View File

@ -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

View File

@ -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):