Compare commits

..

No commits in common. "f5fb33c2c5f6b24b077a01a7e5edba7100916f70" and "4dbd8ae82d92f2541c72f4bb481bf0819ee73186" have entirely different histories.

7 changed files with 36 additions and 38 deletions

View File

@ -21,6 +21,9 @@ class VoucherAdmin(admin.ModelAdmin):
valid.boolean = True
class PhotoAlbumsAdmin(admin.ModelAdmin):
list_display = ('label', 'place', 'url' )
class ExternalLinksAdmin(admin.ModelAdmin):
list_display = ('label', 'place', 'url', 'linktype' )
@ -34,4 +37,5 @@ admin.site.register(Explorer)
admin.site.register(Voucher, VoucherAdmin)
admin.site.register(Place, PlacesAdmin)
admin.site.register(PlaceImage, PlaceImagesAdmin)
admin.site.register(PhotoAlbum, PhotoAlbumsAdmin)
admin.site.register(ExternalLink, ExternalLinksAdmin)

View File

@ -104,7 +104,7 @@ class PlaceAsset(Submittable):
"""
class Meta:
abstract = True
abstract = True
place = models.ForeignKey(
Place,

View File

@ -104,16 +104,16 @@
</section>
<section class=" LP-Section">
<h1 class="LP-Headline">{% translate 'External links submitted by' %} {{explorer.user.username}}</h1>
<h1 class="LP-Headline">{% translate 'Photo albums submitted by' %} {{explorer.user.username}}</h1>
<div class="LP-LinkList">
<ul class="LP-LinkList__Container">
{% for external_link in assets.externallinks.all %}
{% for photo_album in assets.photoalbums.all %}
<li class="LP-LinkList__Item">
<a target="_blank" href="{{external_link.url}}" class="LP-Link">
<span class="LP-Text">{{external_link.label}}</span>
<a target="_blank" href="{{photo_album.url}}" class="LP-Link">
<span class="LP-Text">{{photo_album.label}}</span>
</a>
{% if user.explorer == external_link.submitted_by%}
<a href="{% url 'external_link_delete' pk=external_link.pk%}" class="LP-Link LP-LinkList__ItemHover" title="Delete Photo Album">
{% 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>

View File

@ -1,7 +1,7 @@
{% extends 'global.html'%}
{% load i18n %}
{% block title %}{% translate 'Submit an external link' %}{% endblock %}
{% block title %}{% translate 'Submit a photo album' %}{% endblock %}
{% block additional_menu_items %}
<li class="LP-Menu__Item LP-Menu__Item--additional"><a href="{% url 'place_edit' pk=place.pk %}" class="LP-Link"><span
@ -13,7 +13,7 @@
{% block maincontent %}
<form class="LP-Form" method="POST">
<fieldset class="LP-Form__Fieldset">
<legend class="LP-Form__Legend">{% translate 'Submit an external link for' %} {{place.name}}</legend>
<legend class="LP-Form__Legend">{% translate 'Submit a photo album for' %} {{place.name}}</legend>
{% csrf_token %}
<div class="LP-Form__Composition">
<div class="LP-Form__Field">
@ -27,12 +27,6 @@
</div>
</div>
<div class="LP-Form__Composition">
<div class="LP-Form__Field">
{% include 'partials/form/inputField.html' with field=form.linktype %}
</div>
</div>
<div class="LP-Form__Composition LP-Form__Composition--buttons">
{% include 'partials/form/submit.html' with referrer=request.META.HTTP_REFERER %}
</div>

View File

@ -62,16 +62,16 @@
</section>
<section class=" LP-Section">
<h2 class="LP-Headline">{% translate 'External links' %}</h2>
<h1 class="LP-Headline">{% translate 'Photo albums' %}</h1>
<div class="LP-LinkList">
<ul class="LP-LinkList__Container">
{% for external_link in place.externallinks.all %}
{% for photo_album in place.photoalbums.all %}
<li class="LP-LinkList__Item">
<a target="_blank" href="{{external_link.url}}" class="LP-Link">
<span class="LP-Text">{{external_link.label}}</span>
<a target="_blank" href="{{photo_album.url}}" class="LP-Link">
<span class="LP-Text">{{photo_album.label}}</span>
</a>
{% if user.explorer == external_link.submitted_by or user.explorer == place.submitted_by %}
<a href="{% url 'external_link_delete' pk=external_link.pk%}" class="LP-Link LP-LinkList__ItemHover" title="Delete external link">
{% if user.explorer == photo_album.submitted_by or user.explorer == place.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>
@ -80,7 +80,7 @@
</li>
{% endfor %}
<li class="LP-LinkList__Item">
<a href="{% url 'external_link_create' place_id=place.id %}" class="LP-Link">
<a href="{% url 'photo_album_create' place_id=place.id %}" class="LP-Link">
<div class="RV-Iconized__Container RV-Iconized__Container--small">
<svg class="RV-Iconized__Icon" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" xml:space="preserve">
<g>
@ -88,7 +88,7 @@
v216c0,11.046,8.954,20,20,20s20-8.954,20-20V276h216c11.046,0,20-8.954,20-20C512,244.954,503.046,236,492,236z" />
</g>
</svg>
<span class="RV-Iconized__Text">{% translate 'Add external link' %}</span>
<span class="RV-Iconized__Text">{% translate 'Add photo album' %}</span>
</div>
</a>
</li>

View File

@ -19,8 +19,8 @@ from lostplaces.views import (
PlaceVisitDeleteView,
PlaceImageCreateView,
PlaceImageDeleteView,
ExternalLinkCreateView,
ExternalLinkDeleteView,
PhotoAlbumCreateView,
PhotoAlbumDeleteView,
ExplorerProfileView,
ExplorerProfileUpdateView
)
@ -48,6 +48,6 @@ urlpatterns = [
path('place_image/create/<int:place_id>/', PlaceImageCreateView.as_view(), name='place_image_create'),
path('place_image/delete/<int:pk>/', PlaceImageDeleteView.as_view(), name='place_image_delete'),
path('external_link/create/<int:place_id>/', ExternalLinkCreateView.as_view(), name='external_link_create'),
path('external_link/delete/<int:pk>/', ExternalLinkDeleteView.as_view(), name='external_link_delete')
path('photo_album/create/<int:place_id>/', PhotoAlbumCreateView.as_view(), name='photo_album_create'),
path('photo_album/delete/<int:pk>/', PhotoAlbumDeleteView.as_view(), name='photo_album_delete')
]

View File

@ -12,7 +12,7 @@ from django.http import HttpResponseForbidden
from django.utils.translation import ugettext_lazy as _
from lostplaces.forms import SignupVoucherForm, TagSubmitForm
from lostplaces.models import Place, ExternalLink
from lostplaces.models import Place, PhotoAlbum
from lostplaces.views.base_views import IsAuthenticatedMixin
from lostplaces.common import redirect_referer_or
@ -48,17 +48,17 @@ class HomeView(IsAuthenticatedMixin, View):
}
return render(self.request, 'home_unauth.html', context)
class ExternalLinkCreateView(PlaceAssetCreateView):
model = ExternalLink
fields = ['url', 'label', 'linktype']
template_name = 'external_link/external_link_create.html'
success_message = _('External link submitted')
class PhotoAlbumCreateView(PlaceAssetCreateView):
model = PhotoAlbum
fields = ['url', 'label']
template_name = 'photo_album/photo_album_create.html'
success_message = _('Photo album link submitted')
class ExternalLinkDeleteView(PlaceAssetDeleteView):
model = ExternalLink
class PhotoAlbumDeleteView(PlaceAssetDeleteView):
model = PhotoAlbum
pk_url_kwarg = 'pk'
success_message = _('External link deleted')
permission_denied_messsage = _('You are not allowed to edit this external link')
success_message = _('Photo album link deleted')
permission_denied_messsage = _('You are not allowed to edit this photo album link')
class PlaceTagSubmitView(IsAuthenticatedMixin, View):
def post(self, request, tagged_id, *args, **kwargs):