2022-07-12 09:32:05 +01:00
|
|
|
from django.db import models
|
|
|
|
|
|
|
|
|
|
|
|
class UnsplashPhoto(models.Model):
|
|
|
|
unsplash_id = models.CharField(unique=True, max_length=11, db_index=True)
|
|
|
|
data = models.JSONField()
|
2022-07-12 15:14:27 +01:00
|
|
|
|
|
|
|
def get_description(self) -> str:
|
|
|
|
return self.data["description"]
|
2022-07-12 15:48:40 +01:00
|
|
|
|
2022-07-12 22:45:50 +01:00
|
|
|
def get_hero_image_url(self) -> str:
|
|
|
|
return self.data["urls"]["regular"]
|
|
|
|
|
2022-07-12 15:48:40 +01:00
|
|
|
def get_thumbnail_url(self) -> str:
|
|
|
|
return self.data["urls"]["thumb"]
|