Compare commits
4 Commits
d35cb8131a
...
201ef73639
Author | SHA1 | Date | |
---|---|---|---|
201ef73639 | |||
af7afd0311 | |||
cf6346fdf0 | |||
d641d7b44d |
@ -67,14 +67,14 @@ class PlaceForm(forms.ModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Place
|
model = Place
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
exclude = ['submitted_by', 'latitude', 'longitute']
|
exclude = ['submitted_by']
|
||||||
|
|
||||||
latitude = forms.IntegerField(
|
latitude = forms.DecimalField(
|
||||||
widget=forms.NumberInput(attrs={'min':-90,'max': 90,'type': 'number'})
|
widget=forms.NumberInput(attrs={'min':-90,'max': 90,'type': 'number', 'step': 'any'})
|
||||||
)
|
)
|
||||||
|
|
||||||
longitude = forms.IntegerField(
|
longitude = forms.DecimalField(
|
||||||
widget=forms.NumberInput(attrs={'min':-180,'max': 180,'type': 'number'})
|
widget=forms.NumberInput(attrs={'min':-180,'max': 180,'type': 'number', 'step': 'any'})
|
||||||
)
|
)
|
||||||
|
|
||||||
class PlaceImageForm(forms.ModelForm):
|
class PlaceImageForm(forms.ModelForm):
|
||||||
|
@ -48,7 +48,6 @@ class Place(Submittable, Taggable, Mapable):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
def generate_place_image_filename(instance, filename):
|
def generate_place_image_filename(instance, filename):
|
||||||
"""
|
"""
|
||||||
Callback for generating filename for uploaded place images.
|
Callback for generating filename for uploaded place images.
|
||||||
@ -57,6 +56,9 @@ def generate_place_image_filename(instance, filename):
|
|||||||
|
|
||||||
return 'places/' + str(instance.place.pk) + '-' + str(instance.place.name) + '.' + filename.split('.')[-1]
|
return 'places/' + str(instance.place.pk) + '-' + str(instance.place.name) + '.' + filename.split('.')[-1]
|
||||||
|
|
||||||
|
def generate_image_upload_path(instance, filename):
|
||||||
|
return generate_place_image_filename(instance, filename)
|
||||||
|
|
||||||
class PlaceAsset(Submittable):
|
class PlaceAsset(Submittable):
|
||||||
"""
|
"""
|
||||||
Assets to a place, i.e. images
|
Assets to a place, i.e. images
|
||||||
|
@ -33,5 +33,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
<li class="LP-ImageGrid__Item LP-ImageGrid__Item--add" title="Bild hinzufügen">
|
||||||
|
<a class="LP-Link" href="{% url 'place_image_create' place_id=place.id%}">
|
||||||
|
<img class="LP-Icon" src="{% static 'icons/plus.svg' %}" />
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
@ -3,7 +3,7 @@
|
|||||||
<article class="LP-PlaceTeaser {% if extended %} LP-PlaceTeaser--extended{% endif %}">
|
<article class="LP-PlaceTeaser {% if extended %} LP-PlaceTeaser--extended{% endif %}">
|
||||||
<div class="LP-PlaceTeaser__Image">
|
<div class="LP-PlaceTeaser__Image">
|
||||||
{% if place.placeimages.all|length > 0 %}
|
{% if place.placeimages.all|length > 0 %}
|
||||||
{% include 'partials/image.html' with source_url=place.placeimages.first.filename.thumbnail.url %}
|
{% include 'partials/image.html' with source_url=place.placeimages.first.filename.thumbnail.url link_url=place.get_absolute_url%}
|
||||||
{% else %}
|
{% else %}
|
||||||
<img class="LP-Image" src="{% static 'images/missing_image.png' %}" />
|
<img class="LP-Image" src="{% static 'images/missing_image.png' %}" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user