feat: Remove unused title from image

This commit is contained in:
moanos [he/him] 2024-05-31 13:51:14 +02:00
parent 8d92539b22
commit 5f13736753
2 changed files with 6 additions and 5 deletions

View File

@ -90,7 +90,7 @@ class ImageForm(forms.ModelForm):
class Meta: class Meta:
model = Image model = Image
fields = ('title', 'image', 'alt_text') fields = ('image', 'alt_text')
class ReportAdoptionNoticeForm(forms.ModelForm): class ReportAdoptionNoticeForm(forms.ModelForm):

View File

@ -36,12 +36,11 @@ class Language(models.Model):
class Image(models.Model): class Image(models.Model):
title = models.CharField(max_length=200)
image = models.ImageField(upload_to='images') image = models.ImageField(upload_to='images')
alt_text = models.TextField(max_length=2000) alt_text = models.TextField(max_length=2000)
def __str__(self): def __str__(self):
return self.title return self.alt_text
@property @property
def as_html(self): def as_html(self):
@ -75,8 +74,10 @@ class Location(models.Model):
@staticmethod @staticmethod
def get_location_from_string(location_string): def get_location_from_string(location_string):
geo_api = geo.GeoAPI() geo_api = geo.GeoAPI()
get_geojson = geo_api.get_geojson_for_query(location_string) geojson = geo_api.get_geojson_for_query(location_string)
result = get_geojson[0] if geojson is None:
return None
result = geojson[0]
if "name" in result: if "name" in result:
name = result["name"] name = result["name"]
else: else: