mirror of
https://github.com/TrentSPalmer/trentpalmerdotorg.git
synced 2024-12-22 13:02:49 -08:00
add license/attribution info for feed images
This commit is contained in:
parent
ffa103e26c
commit
81281c1baf
6
audio/choices.py
Normal file
6
audio/choices.py
Normal file
@ -0,0 +1,6 @@
|
||||
LICENSE_CHOICES = [
|
||||
(1, 'Public Domain'),
|
||||
(2, 'Unknown'),
|
||||
(3, 'CC BY-SA 2.5'),
|
||||
(4, 'CC BY-SA 3.0')
|
||||
]
|
@ -7,7 +7,10 @@ class FeedForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Feed
|
||||
fields = [
|
||||
'title', 'author', 'description', 'image'
|
||||
'title', 'author', 'description',
|
||||
'image_title', 'image_attribution', 'image_attribution_url',
|
||||
'original_image_url', 'image_license',
|
||||
'image_license_jurisdiction', 'image'
|
||||
]
|
||||
|
||||
|
||||
@ -20,5 +23,6 @@ class EpisodeForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Episode
|
||||
fields = [
|
||||
'title', 'author', 'pub_date', 'episode_number', 'description', 'image', 'mp3'
|
||||
'title', 'author', 'pub_date', 'episode_number',
|
||||
'description', 'image', 'mp3'
|
||||
]
|
||||
|
18
audio/migrations/0011_feed_image_license.py
Normal file
18
audio/migrations/0011_feed_image_license.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.1.7 on 2021-03-16 16:34
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('audio', '0010_episode_episode_number'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='feed',
|
||||
name='image_license',
|
||||
field=models.SmallIntegerField(choices=[(1, 'Public Domain'), (2, 'Unknown'), (3, 'CC BY-SA 2.5'), (4, 'CC BY-SA 3.0')], default=2),
|
||||
),
|
||||
]
|
33
audio/migrations/0012_auto_20210316_1053.py
Normal file
33
audio/migrations/0012_auto_20210316_1053.py
Normal file
@ -0,0 +1,33 @@
|
||||
# Generated by Django 3.1.7 on 2021-03-16 17:53
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('audio', '0011_feed_image_license'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='feed',
|
||||
name='image_attribution',
|
||||
field=models.CharField(default='', max_length=255),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='feed',
|
||||
name='image_attribution_url',
|
||||
field=models.URLField(blank=True, max_length=255),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='feed',
|
||||
name='image_title',
|
||||
field=models.CharField(default='', max_length=255),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='feed',
|
||||
name='original_image_url',
|
||||
field=models.URLField(default='', max_length=255),
|
||||
),
|
||||
]
|
18
audio/migrations/0013_feed_image_license_jurisdiction.py
Normal file
18
audio/migrations/0013_feed_image_license_jurisdiction.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.1.7 on 2021-03-16 17:54
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('audio', '0012_auto_20210316_1053'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='feed',
|
||||
name='image_license_jurisdiction',
|
||||
field=models.TextField(default=''),
|
||||
),
|
||||
]
|
@ -3,6 +3,7 @@ from tp.models import UUIDAsIDModel
|
||||
from django.contrib.auth.models import User
|
||||
from django.utils.text import slugify
|
||||
from tp.storage_backends import PublicImageStorage, PublicMP3Storage
|
||||
from .choices import LICENSE_CHOICES
|
||||
import string, random
|
||||
|
||||
|
||||
@ -28,6 +29,16 @@ class Feed(UUIDAsIDModel):
|
||||
upload_to=slugify_file_name,
|
||||
null=True, blank=True)
|
||||
|
||||
image_license = models.SmallIntegerField(
|
||||
choices=LICENSE_CHOICES,
|
||||
default=2,
|
||||
)
|
||||
image_title = models.CharField(max_length=255, default='')
|
||||
image_attribution = models.CharField(max_length=255, default='')
|
||||
image_attribution_url = models.URLField(max_length=255, blank=True)
|
||||
original_image_url = models.URLField(max_length=255, default='')
|
||||
image_license_jurisdiction = models.TextField(null=False, default='')
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.slug:
|
||||
self.slug = slugify(rand_slug() + "-" + self.title)
|
||||
|
Loading…
Reference in New Issue
Block a user