Compare commits
18 Commits
d04e986419
...
e601b9bf6b
Author | SHA1 | Date | |
---|---|---|---|
e601b9bf6b | |||
6f6bd6376d | |||
dc2a703c39 | |||
063777ece4 | |||
4675e5814f | |||
35e0f912fe | |||
07fe1bc3ca | |||
4a43a4bf37 | |||
61cf148417 | |||
d547ee9db3 | |||
c7b699f615 | |||
86f95a5dd0 | |||
916c4b80f7 | |||
b31dc9fc5f | |||
8f048369bf | |||
f974469996 | |||
dbbd7b0802 | |||
abca946883 |
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-10-11 21:53+0200\n"
|
||||
"POT-Creation-Date: 2020-12-24 16:29+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: Commander1024 <commander@commander1024.de>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -30,7 +30,7 @@ msgstr "Ungültiger Voucher"
|
||||
msgid "Expired voucher"
|
||||
msgstr "Abgelaufener Voucher"
|
||||
|
||||
#: models/abstract_models.py:29
|
||||
#: models/abstract_models.py:29 templates/explorer/profile.html:19
|
||||
msgid "Name"
|
||||
msgstr "Name"
|
||||
|
||||
@ -74,6 +74,16 @@ msgstr "Adresse (URL)"
|
||||
msgid "link text"
|
||||
msgstr "Linktext"
|
||||
|
||||
#: models/models.py:46
|
||||
#, fuzzy
|
||||
#| msgid "Filename(s)"
|
||||
msgid "Filename"
|
||||
msgstr "Dateiname(n)"
|
||||
|
||||
#: models/models.py:47
|
||||
msgid "Optional profile pic for display in explorer profile"
|
||||
msgstr ""
|
||||
|
||||
#: models/place.py:21
|
||||
msgid "Location"
|
||||
msgstr "Ort"
|
||||
@ -110,38 +120,78 @@ msgstr "Du wirst in 5 Sekunden weitergeleitet"
|
||||
msgid "Go Back"
|
||||
msgstr "Zurück"
|
||||
|
||||
#: templates/explorer/profile.html:27
|
||||
msgid "E-Mail"
|
||||
msgstr ""
|
||||
|
||||
#: templates/explorer/profile.html:35
|
||||
msgid "Joined"
|
||||
msgstr ""
|
||||
|
||||
#: templates/explorer/profile.html:43
|
||||
#, fuzzy
|
||||
#| msgid "All Places"
|
||||
msgid "Places"
|
||||
msgstr "Alle Places"
|
||||
|
||||
#: templates/explorer/profile.html:51
|
||||
msgid "Place Assets"
|
||||
msgstr ""
|
||||
|
||||
#: templates/explorer/profile.html:65
|
||||
#, fuzzy
|
||||
#| msgid "Image(s) submitted successfully"
|
||||
msgid "Places submitted by"
|
||||
msgstr "Bild(er) erfolgreich hinzugefügt"
|
||||
|
||||
#: templates/explorer/profile.html:82
|
||||
#, fuzzy
|
||||
#| msgid "Image(s) submitted successfully"
|
||||
msgid "Images submitted by"
|
||||
msgstr "Bild(er) erfolgreich hinzugefügt"
|
||||
|
||||
#: templates/explorer/profile.html:104
|
||||
#, fuzzy
|
||||
#| msgid "Photo album link submitted"
|
||||
msgid "Photo albums submitted by"
|
||||
msgstr "Fotoalbum-Link hinzugefügt"
|
||||
|
||||
#: templates/global.html:32
|
||||
msgid "Logout"
|
||||
msgstr "Ausloggen"
|
||||
|
||||
#: templates/global.html:34
|
||||
#: templates/global.html:33
|
||||
msgid "Profile"
|
||||
msgstr ""
|
||||
|
||||
#: templates/global.html:35
|
||||
msgid "Admin"
|
||||
msgstr "Admin"
|
||||
|
||||
#: templates/global.html:39 templates/registration/login.html:4
|
||||
#: templates/global.html:40 templates/registration/login.html:4
|
||||
#: templates/registration/login.html:10 templates/registration/login.html:23
|
||||
msgid "Login"
|
||||
msgstr "Anmelden"
|
||||
|
||||
#: templates/global.html:40 templates/registration/login.html:29
|
||||
#: templates/global.html:41 templates/registration/login.html:29
|
||||
#: templates/signup.html:6 templates/signup.html:12 templates/signup.html:41
|
||||
msgid "Sign up"
|
||||
msgstr "Registrieren"
|
||||
|
||||
#: templates/global.html:50 templates/home.html:10
|
||||
#: templates/global.html:51 templates/home.html:10
|
||||
msgid "Home"
|
||||
msgstr "Startseite"
|
||||
|
||||
#: templates/global.html:51
|
||||
#: templates/global.html:52
|
||||
msgid "UrBex Codex"
|
||||
msgstr "UrBex Codex"
|
||||
|
||||
#: templates/global.html:56 templates/place/place_create.html:5
|
||||
#: templates/global.html:57 templates/place/place_create.html:5
|
||||
#: templates/place/place_create.html:10
|
||||
msgid "Create place"
|
||||
msgstr "Place erstellen"
|
||||
|
||||
#: templates/global.html:57
|
||||
#: templates/global.html:58
|
||||
msgid "All places"
|
||||
msgstr "Alle Places"
|
||||
|
||||
|
@ -0,0 +1,22 @@
|
||||
# Generated by Django 3.1.1 on 2020-10-04 19:37
|
||||
# Edited by reverend
|
||||
|
||||
import datetime
|
||||
from django.db import migrations, models
|
||||
import django.utils.timezone
|
||||
from django.utils.timezone import utc
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lostplaces', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.DeleteModel(
|
||||
name='Voucher'
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='Expireable'
|
||||
)
|
||||
]
|
@ -6,7 +6,7 @@ from django.db import migrations, models
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('lostplaces', '0002_reomve_vouchers'),
|
||||
('lostplaces', '0002_remove_vouchers'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
@ -6,14 +6,28 @@
|
||||
database.
|
||||
'''
|
||||
|
||||
import os
|
||||
import uuid
|
||||
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
from django.db.models.signals import post_save
|
||||
from django.dispatch import receiver
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from lostplaces.models.abstract_models import Expireable
|
||||
from lostplaces.models.place import Place
|
||||
|
||||
from easy_thumbnails.fields import ThumbnailerImageField
|
||||
from easy_thumbnails.files import get_thumbnailer
|
||||
|
||||
def generate_profile_image_filename(instance, filename):
|
||||
"""
|
||||
Callback for generating filename for uploaded explorer profile images.
|
||||
Returns filename as: explorer_pk-username.jpg
|
||||
"""
|
||||
|
||||
return 'explorers/' + str(instance.explorer.pk) + '-' + str(instance.explorer.username) + '.' + filename.split('.')[-1]
|
||||
|
||||
class Explorer(models.Model):
|
||||
"""
|
||||
@ -26,6 +40,22 @@ class Explorer(models.Model):
|
||||
on_delete=models.CASCADE,
|
||||
related_name='explorer'
|
||||
)
|
||||
profile_image = ThumbnailerImageField(
|
||||
blank=True,
|
||||
null=True,
|
||||
upload_to=generate_profile_image_filename,
|
||||
resize_source=dict(size=(400, 400),
|
||||
sharpen=True),
|
||||
verbose_name=_('Profile image'),
|
||||
help_text=_('Optional profile pic for display in explorer profile')
|
||||
)
|
||||
|
||||
favorite_places = models.ManyToManyField(
|
||||
Place,
|
||||
related_name='favorite_places',
|
||||
verbose_name='Explorers favorite places',
|
||||
blank=True
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return self.user.username
|
||||
@ -58,4 +88,3 @@ class Voucher(Expireable):
|
||||
|
||||
def __str__(self):
|
||||
return "Voucher " + str(self.code)
|
||||
|
||||
|
@ -49,10 +49,10 @@ class Place(Submittable, Taggable, Mapable):
|
||||
return self.name
|
||||
|
||||
|
||||
def generate_image_upload_path(instance, filename):
|
||||
def generate_place_image_filename(instance, filename):
|
||||
"""
|
||||
Callback for generating path for uploaded images.
|
||||
Returns filename as: place_pk-placename{-rnd_string}.jpg
|
||||
Callback for generating filename for uploaded place images.
|
||||
Returns filename as: place_pk-placename{-number}.jpg
|
||||
"""
|
||||
|
||||
return 'places/' + str(instance.place.pk) + '-' + str(instance.place.name) + '.' + filename.split('.')[-1]
|
||||
@ -84,7 +84,7 @@ class PlaceImage (PlaceAsset):
|
||||
verbose_name=_('Description'),
|
||||
)
|
||||
filename = ThumbnailerImageField(
|
||||
upload_to=generate_image_upload_path,
|
||||
upload_to=generate_place_image_filename,
|
||||
resize_source=dict(size=(2560, 2560),
|
||||
sharpen=True),
|
||||
verbose_name=_('Filename(s)'),
|
||||
|
163
django_lostplaces/lostplaces/static/icons/favourite_filled.svg
Normal file
163
django_lostplaces/lostplaces/static/icons/favourite_filled.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 108 KiB |
@ -61,65 +61,63 @@
|
||||
</div>
|
||||
|
||||
<section class="LP-Section">
|
||||
<div class="LP-PlaceList">
|
||||
<h1 class="LP-Headline">{% trans 'Places submitted by' %} {{explorer.user.username}}</h1>
|
||||
<ul class="LP-PlaceList__List">
|
||||
{% for place in place_list %}
|
||||
<li class="LP-PlaceList__Item">
|
||||
<a href="{% url 'place_detail' pk=place.pk %}" class="LP-Link">
|
||||
{% include 'partials/place_teaser.html' with place=place extended=True %}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<div class="LP-PlaceList">
|
||||
<h1 class="LP-Headline">{% trans 'Places submitted by' %} {{explorer.user.username}}</h1>
|
||||
<ul class="LP-PlaceList__List">
|
||||
{% for place in place_list %}
|
||||
<li class="LP-PlaceList__Item">
|
||||
{% include 'partials/place_teaser.html' with place=place extended=True %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% include 'partials/nav/pagination.html' %}
|
||||
{% include 'partials/nav/pagination.html' %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="LP-Section">
|
||||
<h1 class="LP-Headline">{% trans 'Images submitted by' %} {{explorer.user.username}}</h1>
|
||||
<div class="LP-ImageGrid">
|
||||
<ul class="LP-ImageGrid__Container">
|
||||
{% for place_image in assets.placeimages.all %}
|
||||
<li class="LP-ImageGrid__Item">
|
||||
<a href="{{ place_image.filename.large.url }}" class="LP-Link">
|
||||
<img class="LP-Image" src="{{ place_image.filename.thumbnail.url }}">
|
||||
</a>
|
||||
{% if user.explorer == place_image.submitted_by%}
|
||||
<span class="LP-ImageGrid__DeleteItem" title="Bild löschen">
|
||||
<a href="{% url 'place_image_delete' pk=place_image.id %}" class="LP-Link">
|
||||
<img class="LP-Icon" src="{% static 'icons/cancel.svg' %}" />
|
||||
</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<h1 class="LP-Headline">{% trans 'Images submitted by' %} {{explorer.user.username}}</h1>
|
||||
<div class="LP-ImageGrid">
|
||||
<ul class="LP-ImageGrid__Container">
|
||||
{% for place_image in assets.placeimages.all %}
|
||||
<li class="LP-ImageGrid__Item">
|
||||
<a href="{{ place_image.filename.large.url }}" class="LP-Link">
|
||||
<img class="LP-Image" src="{{ place_image.filename.thumbnail.url }}">
|
||||
</a>
|
||||
{% if user.explorer == place_image.submitted_by%}
|
||||
<span class="LP-ImageGrid__DeleteItem" title="Bild löschen">
|
||||
<a href="{% url 'place_image_delete' pk=place_image.id %}" class="LP-Link">
|
||||
<img class="LP-Icon" src="{% static 'icons/cancel.svg' %}" />
|
||||
</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class=" LP-Section">
|
||||
<h1 class="LP-Headline">{% trans 'Photo albums submitted by' %} {{explorer.user.username}}</h1>
|
||||
<div class="LP-LinkList">
|
||||
<ul class="LP-LinkList__Container">
|
||||
{% for photo_album in assets.photoalbums.all %}
|
||||
<li class="LP-LinkList__Item">
|
||||
<a target="_blank" href="{{photo_album.url}}" class="LP-Link">
|
||||
<span class="LP-Text">{{photo_album.label}}</span>
|
||||
</a>
|
||||
{% if user.explorer == photo_album.submitted_by%}
|
||||
<a href="{% url 'photo_album_delete' pk=photo_album.pk%}" class="LP-Link LP-LinkList__ItemHover" title="Delete Photo Album">
|
||||
<div class="RV-Iconized__Container RV-Iconized__Container--small">
|
||||
{% icon 'trash' className="RV-Iconized__Icon" %}
|
||||
</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<h1 class="LP-Headline">{% trans 'Photo albums submitted by' %} {{explorer.user.username}}</h1>
|
||||
<div class="LP-LinkList">
|
||||
<ul class="LP-LinkList__Container">
|
||||
{% for photo_album in assets.photoalbums.all %}
|
||||
<li class="LP-LinkList__Item">
|
||||
<a target="_blank" href="{{photo_album.url}}" class="LP-Link">
|
||||
<span class="LP-Text">{{photo_album.label}}</span>
|
||||
</a>
|
||||
{% if user.explorer == photo_album.submitted_by%}
|
||||
<a href="{% url 'photo_album_delete' pk=photo_album.pk%}" class="LP-Link LP-LinkList__ItemHover" title="Delete Photo Album">
|
||||
<div class="RV-Iconized__Container RV-Iconized__Container--small">
|
||||
{% icon 'trash' className="RV-Iconized__Icon" %}
|
||||
</div>
|
||||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% endblock maincontent %}
|
@ -21,9 +21,7 @@
|
||||
<ul class="LP-PlaceGrid__Grid">
|
||||
{% for place in place_list %}
|
||||
<li class="LP-PlaceGrid__Item">
|
||||
<a href="{% url 'place_detail' pk=place.pk %}" class="LP-Link">
|
||||
{% include 'partials/place_teaser.html' with place=place%}
|
||||
</a>
|
||||
{% include 'partials/place_teaser.html' with place=place%}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
@ -0,0 +1,14 @@
|
||||
{%load static %}
|
||||
{% load i18n %}
|
||||
|
||||
{% if request.user %}
|
||||
{% if place in request.user.explorer.favorite_places.all %}
|
||||
<a href="{% url 'place_unfavorite' place_id=place.id %}" class="LP-Link" title="{% trans 'Remove from favorites' %}">
|
||||
<img class="LP-Icon" src="{% static '/icons/favourite_filled.svg' %}" />
|
||||
</a>
|
||||
{%else%}
|
||||
<a href="{% url 'place_favorite' place_id=place.id %}" class="LP-Link" title="{% trans 'Save as favorite' %}">
|
||||
<img class="LP-Icon" src="{% static '/icons/favourite.svg' %}" />
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
@ -1,13 +1,15 @@
|
||||
{%load static %}
|
||||
|
||||
<article class="LP-PlaceTeaser {% if extended %} LP-PlaceTeaser--extended{% endif %}">
|
||||
<div class="LP-PlaceTeaser__Image">
|
||||
{% if place.placeimages.all|length > 0 %}
|
||||
<a href="{% url 'place_detail' pk=place.pk %}" class="LP-Link">
|
||||
<div class="LP-PlaceTeaser__Image">
|
||||
{% if place.placeimages.all|length > 0 %}
|
||||
<img class="LP-Image" src="{{ place.placeimages.first.filename.thumbnail.url}}" />
|
||||
{% else %}
|
||||
{% else %}
|
||||
<img class="LP-Image" src="{% static 'images/missing_image.png' %}" />
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</a>
|
||||
<div class="LP-PlaceTeaser__Meta">
|
||||
<div class="LP-PlaceTeaser__Info">
|
||||
<span class="LP-PlaceTeaser__Title">
|
||||
@ -20,15 +22,15 @@
|
||||
<div class="LP-PlaceTeaser__Description">
|
||||
<p class="LP-Paragraph">
|
||||
{% if place.description|length > 210 %}
|
||||
{{place.description|truncatechars:210|truncatewords:-1}}
|
||||
{{place.description|truncatechars:210|truncatewords:-1}}
|
||||
{% else %}
|
||||
{{place.description}}
|
||||
{{place.description}}
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
<div class="LP-PlaceTeaser__Icons">
|
||||
<ul class="LP-Icon__List">
|
||||
<li class="LP-Icon__Item"><img class="LP-Icon" src="{% static '/icons/favourite.svg' %}" /></li>
|
||||
<li class="LP-Icon__Item">{% include 'partials/icons/place_favorite.html' with place=place%}</li>
|
||||
<li class="LP-Icon__Item"><img class="LP-Icon" src="{% static '/icons/location.svg' %}" /></li>
|
||||
<li class="LP-Icon__Item"><img class="LP-Icon" src="{% static '/icons/flag.svg' %}" /></li>
|
||||
</ul>
|
||||
|
@ -23,7 +23,7 @@
|
||||
<article class="LP-PlaceDetail">
|
||||
|
||||
<header class="LP-PlaceDetail__Header">
|
||||
<h1 class="LP-Headline">{{ place.name }}</h1>
|
||||
<h1 class="LP-Headline">{{ place.name }} {% include 'partials/icons/place_favorite.html' %}</h1>
|
||||
{% if place.placeimages.first.filename.hero.url %}
|
||||
<figure class="LP-PlaceDetail__Image">
|
||||
<img src="{{ place.placeimages.first.filename.hero.url }}" class="LP-Image" />
|
||||
|
@ -17,9 +17,7 @@
|
||||
<ul class="LP-PlaceList__List">
|
||||
{% for place in place_list %}
|
||||
<li class="LP-PlaceList__Item">
|
||||
<a href="{% url 'place_detail' pk=place.pk %}" class="LP-Link">
|
||||
{% include 'partials/place_teaser.html' with place=place extended=True %}
|
||||
</a>
|
||||
{% include 'partials/place_teaser.html' with place=place extended=True %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
@ -11,6 +11,8 @@ from lostplaces.views import (
|
||||
PlaceDeleteView,
|
||||
PlaceTagDeleteView,
|
||||
PlaceTagSubmitView,
|
||||
PlaceFavoriteView,
|
||||
PlaceUnfavoriteView,
|
||||
PhotoAlbumCreateView,
|
||||
PhotoAlbumDeleteView,
|
||||
PlaceImageCreateView,
|
||||
@ -36,5 +38,10 @@ urlpatterns = [
|
||||
path('place/tag/<int:tagged_id>', PlaceTagSubmitView.as_view(), name='place_tag_submit'),
|
||||
path('place/tag/delete/<int:tagged_id>/<int:tag_id>', PlaceTagDeleteView.as_view(), name='place_tag_delete'),
|
||||
|
||||
path('explorer/<int:explorer_id>/', ExplorerProfileView.as_view(), name='explorer_profile')
|
||||
path('explorer/<int:explorer_id>/', ExplorerProfileView.as_view(), name='explorer_profile'),
|
||||
|
||||
path('explorer/favorite/<int:place_id>/', PlaceFavoriteView.as_view(), name='place_favorite'),
|
||||
path('explorer/unfavorite/<int:place_id>/', PlaceUnfavoriteView.as_view(), name='place_unfavorite')
|
||||
|
||||
|
||||
]
|
||||
|
@ -119,3 +119,35 @@ class PlaceDeleteView(IsAuthenticatedMixin, IsPlaceSubmitterMixin, DeleteView):
|
||||
|
||||
def get_place(self):
|
||||
return self.get_object()
|
||||
|
||||
class PlaceFavoriteView(IsAuthenticatedMixin, View):
|
||||
|
||||
def get(self, request, place_id):
|
||||
place = get_object_or_404(Place, id=place_id)
|
||||
if request.user is not None:
|
||||
request.user.explorer.favorite_places.add(place)
|
||||
request.user.explorer.save()
|
||||
|
||||
referer = request.META.get('HTTP_REFERER')
|
||||
if referer is not None:
|
||||
return redirect(referer)
|
||||
else:
|
||||
return redirect(
|
||||
reverse_lazy('place_detail', kwargs={'pk': place.pk})
|
||||
)
|
||||
|
||||
class PlaceUnfavoriteView(IsAuthenticatedMixin, View):
|
||||
|
||||
def get(self, request, place_id):
|
||||
place = get_object_or_404(Place, id=place_id)
|
||||
if request.user is not None:
|
||||
request.user.explorer.favorite_places.remove(place)
|
||||
request.user.explorer.save()
|
||||
|
||||
referer = request.META.get('HTTP_REFERER')
|
||||
if referer is not None:
|
||||
return redirect(referer)
|
||||
else:
|
||||
return redirect(
|
||||
reverse_lazy('place_detail', kwargs={'pk': place.pk})
|
||||
)
|
Loading…
Reference in New Issue
Block a user