1
0
Fork 0
mirror of https://github.com/Findus23/acronomy.git synced 2024-09-19 15:33:45 +02:00

make Artist optional

This commit is contained in:
Lukas Winkler 2020-07-18 22:19:03 +02:00
parent 59680a5ee6
commit 96dd9bab88
Signed by: lukas
GPG key ID: 54DE4D798D244853
3 changed files with 22 additions and 3 deletions

View file

@ -0,0 +1,18 @@
# Generated by Django 3.0.8 on 2020-07-18 20:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('acros', '0042_auto_20200718_2017'),
]
operations = [
migrations.AlterField(
model_name='wikipediaimage',
name='artist',
field=models.TextField(blank=True, null=True),
),
]

View file

@ -16,7 +16,7 @@ class WikipediaImage(models.Model):
imageurl = models.URLField()
caption = models.CharField(max_length=1000, null=True, blank=True)
credit = models.TextField(null=True, blank=True)
artist = models.TextField()
artist = models.TextField(null=True, blank=True)
license_short_name = models.TextField()
attribution = models.TextField(null=True, blank=True)
license_url = models.URLField(null=True, blank=True)

View file

@ -106,8 +106,9 @@ class WikipediaImageAPIObject:
return clean_html(self.extmetadata["Credit"]["value"])
@property
def artist(self) -> str:
return clean_html(self.extmetadata["Artist"]["value"])
def artist(self) -> Optional[str]:
if "Artist" in self.extmetadata:
return clean_html(self.extmetadata["Artist"]["value"])
@property
def license_short_name(self) -> str: