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:
parent
b3a6baf61a
commit
59680a5ee6
3 changed files with 27 additions and 4 deletions
23
acros/migrations/0042_auto_20200718_2017.py
Normal file
23
acros/migrations/0042_auto_20200718_2017.py
Normal 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/'),
|
||||
),
|
||||
]
|
|
@ -15,7 +15,7 @@ class WikipediaImage(models.Model):
|
|||
thumb_height = models.IntegerField(blank=True, editable=False, null=True)
|
||||
imageurl = models.URLField()
|
||||
caption = models.CharField(max_length=1000, null=True, blank=True)
|
||||
credit = models.TextField()
|
||||
credit = models.TextField(null=True, blank=True)
|
||||
artist = models.TextField()
|
||||
license_short_name = models.TextField()
|
||||
attribution = models.TextField(null=True, blank=True)
|
||||
|
|
|
@ -101,8 +101,8 @@ class WikipediaImageAPIObject:
|
|||
return clean_html(self.extmetadata["ImageDescription"]["value"])
|
||||
|
||||
@property
|
||||
def credit(self) -> str:
|
||||
print(self.extmetadata["Credit"])
|
||||
def credit(self) -> Optional[str]:
|
||||
if "Credit" in self.extmetadata:
|
||||
return clean_html(self.extmetadata["Credit"]["value"])
|
||||
|
||||
@property
|
||||
|
|
Loading…
Reference in a new issue