Some URL fields for projects (#12)
* Add some URLFields to projects * null=False version
This commit is contained in:
parent
3b62d63fbb
commit
d5978edd29
|
@ -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),
|
||||||
|
),
|
||||||
|
]
|
|
@ -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,
|
||||||
|
),
|
||||||
|
]
|
|
@ -22,6 +22,9 @@ class Project(models.Model):
|
||||||
slug = models.SlugField(max_length=255, unique=True)
|
slug = models.SlugField(max_length=255, unique=True)
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
auth_key = models.CharField(max_length=AUTH_KEY_LEN, default=gen_auth_key)
|
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:
|
def __str__(self) -> str:
|
||||||
return self.slug
|
return self.slug
|
||||||
|
|
|
@ -14,7 +14,14 @@ class ProjectSerializer(serializers.HyperlinkedModelSerializer):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Project
|
model = Project
|
||||||
fields = ["slug", "name", "versions"]
|
fields = [
|
||||||
|
"slug",
|
||||||
|
"name",
|
||||||
|
"versions",
|
||||||
|
"repository",
|
||||||
|
"discord",
|
||||||
|
"website",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class MeasureSerializer(serializers.HyperlinkedModelSerializer):
|
class MeasureSerializer(serializers.HyperlinkedModelSerializer):
|
||||||
|
|
Loading…
Reference in New Issue