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:
parent
59680a5ee6
commit
96dd9bab88
3 changed files with 22 additions and 3 deletions
18
acros/migrations/0043_auto_20200718_2018.py
Normal file
18
acros/migrations/0043_auto_20200718_2018.py
Normal 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),
|
||||
),
|
||||
]
|
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue