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

make credit optional

This commit is contained in:
Lukas Winkler 2020-07-18 22:17:48 +02:00
parent b3a6baf61a
commit 59680a5ee6
Signed by: lukas
GPG key ID: 54DE4D798D244853
3 changed files with 27 additions and 4 deletions

View file

@ -0,0 +1,23 @@
# Generated by Django 3.0.8 on 2020-07-18 20:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('acros', '0041_auto_20200718_1937'),
]
operations = [
migrations.AlterField(
model_name='wikipediaimage',
name='credit',
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name='wikipediaimage',
name='thumbnail',
field=models.ImageField(blank=True, null=True, upload_to='wikipedia_images/'),
),
]

View file

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

View file

@ -101,9 +101,9 @@ class WikipediaImageAPIObject:
return clean_html(self.extmetadata["ImageDescription"]["value"]) return clean_html(self.extmetadata["ImageDescription"]["value"])
@property @property
def credit(self) -> str: def credit(self) -> Optional[str]:
print(self.extmetadata["Credit"]) if "Credit" in self.extmetadata:
return clean_html(self.extmetadata["Credit"]["value"]) return clean_html(self.extmetadata["Credit"]["value"])
@property @property
def artist(self) -> str: def artist(self) -> str: