#47 Settings Place Hero when creating a place

This commit is contained in:
reverend 2021-10-01 21:44:35 +02:00
parent a7a3ddfe63
commit b1cd8fd0cc

View File

@ -18,7 +18,10 @@ class MultiplePlaceImageUploadMixin:
submitted_by=submitted_by submitted_by=submitted_by
) )
place_image.save() place_image.save()
if place.hero is None:
place.hero = place.placeimages.all()[0]
place.save()
class PlaceImageCreateView(MultiplePlaceImageUploadMixin, PlaceAssetCreateView): class PlaceImageCreateView(MultiplePlaceImageUploadMixin, PlaceAssetCreateView):
model = PlaceImage model = PlaceImage
form_class = PlaceImageForm form_class = PlaceImageForm