Skip to content
Snippets Groups Projects
Verified Commit b57f65cf authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

feat: add fields to License model

add `needs_author`, `requires_express_permission_for_publication` and `url`

update LicenseSerializer and license fixture
parent efec17ba
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,8 @@
"pk": 1,
"fields": {
"name": "Public Domain",
"identifier": "cc-0"
"identifier": "cc-0",
"url": "https://creativecommons.org/publicdomain/zero/1.0/"
}
},
{
......@@ -12,7 +13,8 @@
"pk": 2,
"fields": {
"name": "Creative Commons Attribution",
"identifier": "cc-by"
"identifier": "cc-by",
"url": "https://creativecommons.org/licenses/by/4.0"
}
},
{
......@@ -20,7 +22,8 @@
"pk": 3,
"fields": {
"name": "Creative Commons Attribution-ShareAlike",
"identifier": "cc-by-sa"
"identifier": "cc-by-sa",
"url": "https://creativecommons.org/licenses/by-sa/4.0"
}
},
{
......@@ -28,7 +31,8 @@
"pk": 4,
"fields": {
"name": "Creative Commons Attribution-NonCommercial",
"identifier": "cc-by-nc"
"identifier": "cc-by-nc",
"url": "https://creativecommons.org/licenses/by-nc/4.0"
}
},
{
......@@ -36,7 +40,8 @@
"pk": 5,
"fields": {
"name": "Creative Commons Attribution-NonCommercial-ShareAlike",
"identifier": "cc-by-nc-sa"
"identifier": "cc-by-nc-sa",
"url": "https://creativecommons.org/licenses/by-nc-sa/4.0"
}
},
{
......@@ -44,7 +49,8 @@
"pk": 6,
"fields": {
"name": "Creative Commons Attribution-NoDerivatives",
"identifier": "cc-by-nd"
"identifier": "cc-by-nd",
"url": "https://creativecommons.org/licenses/by-nd/4.0"
}
},
{
......@@ -52,7 +58,8 @@
"pk": 7,
"fields": {
"name": "Creative Commons Attribution-NonCommercial-NoDerivatives",
"identifier": "cc-by-nc-nd"
"identifier": "cc-by-nc-nd",
"url": "https://creativecommons.org/licenses/by-nc-nd/4.0"
}
},
{
......@@ -60,7 +67,8 @@
"pk": 8,
"fields": {
"name": "All Rights Reserved",
"identifier": "all-rights-reserved"
"identifier": "all-rights-reserved",
"url": ""
}
}
]
\ No newline at end of file
# Generated by Django 4.2.4 on 2023-08-29 20:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("program", "0067_image_license"),
]
operations = [
migrations.AddField(
model_name="license",
name="needs_author",
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name="license",
name="requires_express_permission_for_publication",
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name="license",
name="url",
field=models.URLField(default=""),
),
]
......@@ -114,8 +114,11 @@ class Language(models.Model):
class License(models.Model):
name = models.CharField(max_length=64, help_text="Name of the license")
identifier = models.CharField(max_length=32, help_text="Identifier of the license")
name = models.CharField(max_length=64, help_text="Name of the license")
needs_author = models.BooleanField(default=True)
requires_express_permission_for_publication = models.BooleanField(default=True)
url = models.URLField(default="")
class Meta:
ordering = ("name",)
......
......@@ -188,7 +188,14 @@ class LinkTypeSerializer(serializers.ModelSerializer):
class LicenseSerializer(serializers.ModelSerializer):
class Meta:
model = License
fields = ("id", "name", "identifier")
fields = (
"id",
"identifier",
"name",
"needs_author",
"requires_express_permission_for_publication",
"url",
)
class HostLinkSerializer(serializers.ModelSerializer):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment