Compare commits
16 Commits
master
...
a37a445986
Author | SHA1 | Date | |
---|---|---|---|
a37a445986 | |||
056d937f15 | |||
86f04c08ff | |||
e14ed52eeb | |||
72bfc97fbd | |||
d787651d05 | |||
f5fb33c2c5 | |||
a5bcde301c | |||
14a5387e2d | |||
dd4b4f936b | |||
cf9a5474b8 | |||
961d28e336 | |||
4dbd8ae82d | |||
c3ea5cdccd | |||
caa69d6e6e | |||
5f9ef08e3b |
@@ -24,7 +24,7 @@ user.explorer
|
|||||||
Currently the explorer profile is used by the abstract model 'Submittable' and has the following realated names/fiels:
|
Currently the explorer profile is used by the abstract model 'Submittable' and has the following realated names/fiels:
|
||||||
- [places](###place) A list containing all (lost) places the user has submitted
|
- [places](###place) A list containing all (lost) places the user has submitted
|
||||||
- [placeimages](###placeimages) A list containing all images relating a place that a user has submitted
|
- [placeimages](###placeimages) A list containing all images relating a place that a user has submitted
|
||||||
- [photoalbums](###photoalbums) A list of all photo albums a explorere has submitted
|
- [externallinks](###externallinks) A list of all photo albums a explorere has submitted
|
||||||
|
|
||||||
|
|
||||||
### Taggable
|
### Taggable
|
||||||
@@ -141,15 +141,3 @@ This model represents an URL to an external website. External Link is an PlaceAs
|
|||||||
the URL to the target
|
the URL to the target
|
||||||
`label`
|
`label`
|
||||||
the label that is shown on the website
|
the label that is shown on the website
|
||||||
|
|
||||||
### PhotoAlbum
|
|
||||||
Loacation: `lostplaces.models.external_link.PhototAlbum`
|
|
||||||
Import From: `lostplaces.models.PhotoAlbum`
|
|
||||||
#### Super Classes
|
|
||||||
- django's `models.Model`
|
|
||||||
- [lostplaces.models.Submittable](###submittable)
|
|
||||||
- [lostplaces.models.PlaceAsset](###placeasset)
|
|
||||||
- [lostplaces.models.ExternalLink](###externallink)
|
|
||||||
|
|
||||||
A photo album is a link to an external site that is meant to contain photos of the place it is referenced in. It
|
|
||||||
does not have any fields, just the ones inherited from it's super class [ExternalLink](###externallink).
|
|
@@ -21,8 +21,8 @@ class VoucherAdmin(admin.ModelAdmin):
|
|||||||
|
|
||||||
valid.boolean = True
|
valid.boolean = True
|
||||||
|
|
||||||
class PhotoAlbumsAdmin(admin.ModelAdmin):
|
class ExternalLinksAdmin(admin.ModelAdmin):
|
||||||
list_display = ('label', 'place', 'url' )
|
list_display = ('label', 'place', 'url', 'linktype' )
|
||||||
|
|
||||||
class PlacesAdmin(admin.ModelAdmin):
|
class PlacesAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name', 'submitted_by', 'submitted_when')
|
list_display = ('name', 'submitted_by', 'submitted_when')
|
||||||
@@ -34,4 +34,4 @@ admin.site.register(Explorer)
|
|||||||
admin.site.register(Voucher, VoucherAdmin)
|
admin.site.register(Voucher, VoucherAdmin)
|
||||||
admin.site.register(Place, PlacesAdmin)
|
admin.site.register(Place, PlacesAdmin)
|
||||||
admin.site.register(PlaceImage, PlaceImagesAdmin)
|
admin.site.register(PlaceImage, PlaceImagesAdmin)
|
||||||
admin.site.register(PhotoAlbum, PhotoAlbumsAdmin)
|
admin.site.register(ExternalLink, ExternalLinksAdmin)
|
||||||
|
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 3.2.7 on 2021-10-01 19:50
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('lostplaces', '0007_auto_20211001_1925'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='photoalbum',
|
||||||
|
name='linktype',
|
||||||
|
field=models.CharField(blank=True, max_length=20, null=True, verbose_name='link type'),
|
||||||
|
),
|
||||||
|
]
|
@@ -0,0 +1,37 @@
|
|||||||
|
# Generated by Django 3.2.7 on 2021-10-01 20:13
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('lostplaces', '0008_photoalbum_linktype'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='ExternalLink',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('submitted_when', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Submission date')),
|
||||||
|
('subclass', models.IntegerField(default=-1)),
|
||||||
|
('subclassid', models.IntegerField(default=-1)),
|
||||||
|
('url', models.URLField(verbose_name='URL')),
|
||||||
|
('label', models.CharField(max_length=100, verbose_name='link text')),
|
||||||
|
('linktype', models.CharField(blank=True, max_length=20, null=True, verbose_name='link type')),
|
||||||
|
('place', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='externallinks', to='lostplaces.place')),
|
||||||
|
('submitted_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='externallinks', to='lostplaces.explorer', verbose_name='Submitter')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'abstract': False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='photoalbum',
|
||||||
|
name='externallink_ptr',
|
||||||
|
field=models.OneToOneField(auto_created=True, null=True, blank=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, serialize=False, to='lostplaces.externallink'),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
]
|
@@ -0,0 +1,22 @@
|
|||||||
|
# Generated by Django 3.2.7 on 2021-10-01 20:32
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('lostplaces', '0009_photoalbum_externallink_interim'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
# insert data from subclass into parent class with subclass 'number' and primary key/id
|
||||||
|
migrations.RunSQL("""INSERT INTO lostplaces_externallink (submitted_when, url, label, place_id, submitted_by_id, subclass, subclassid)
|
||||||
|
SELECT submitted_when, url, label, place_id, submitted_by_id, 1, id
|
||||||
|
FROM lostplaces_photoalbum;"""
|
||||||
|
|
||||||
|
),
|
||||||
|
# update subclass primary key to point to parent class (notice composite key values):
|
||||||
|
migrations.RunSQL("UPDATE lostplaces_photoalbum SET externallink_ptr_id=lostplaces_externallink.id FROM lostplaces_externallink WHERE lostplaces_externallink.subclassid=lostplaces_photoalbum.id AND lostplaces_externallink.subclass=1;"
|
||||||
|
),
|
||||||
|
]
|
@@ -0,0 +1,56 @@
|
|||||||
|
# Generated by Django 3.2.7 on 2021-10-01 22:48
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('lostplaces', '0010_photoalbum_externallink_datamigration'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='externallink',
|
||||||
|
name='subclass',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='externallink',
|
||||||
|
name='subclassid',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='photoalbum',
|
||||||
|
name='id',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='photoalbum',
|
||||||
|
name='label',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='photoalbum',
|
||||||
|
name='linktype',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='photoalbum',
|
||||||
|
name='place',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='photoalbum',
|
||||||
|
name='submitted_by',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='photoalbum',
|
||||||
|
name='submitted_when',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='photoalbum',
|
||||||
|
name='url',
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='photoalbum',
|
||||||
|
name='externallink_ptr',
|
||||||
|
field=models.OneToOneField(auto_created=True, default=-1, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='lostplaces.externallink'),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
]
|
@@ -0,0 +1,21 @@
|
|||||||
|
# Generated by Django 3.2.7 on 2021-10-02 02:37
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('lostplaces', '0011_remove_migrated_photoalbum_data'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='externallink',
|
||||||
|
name='linktype',
|
||||||
|
field=models.CharField(blank=True, choices=[('youtube', 'YouTube'), ('vimeo', 'Vimeo'), ('flickr', 'Flickr'), ('googlephotos', 'Google Photos'), ('photoalbum', 'Photo album')], max_length=20, null=True, verbose_name='link type'),
|
||||||
|
),
|
||||||
|
migrations.DeleteModel(
|
||||||
|
name='PhotoAlbum',
|
||||||
|
),
|
||||||
|
]
|
@@ -3,10 +3,23 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
|
|
||||||
from lostplaces.models.place import PlaceAsset
|
from lostplaces.models.place import PlaceAsset
|
||||||
|
|
||||||
|
LINK_TYPES = (
|
||||||
|
('youtube', 'YouTube'),
|
||||||
|
('vimeo', "Vimeo"),
|
||||||
|
('flickr', 'Flickr'),
|
||||||
|
('googlephotos', "Google Photos"),
|
||||||
|
('photoalbum', "Photo album"),
|
||||||
|
)
|
||||||
|
|
||||||
|
LINK_DOMAINS = {
|
||||||
|
'youtu.be': 'youtube',
|
||||||
|
'y2u.be': 'youtube',
|
||||||
|
}
|
||||||
|
|
||||||
class ExternalLink(PlaceAsset):
|
class ExternalLink(PlaceAsset):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = False
|
||||||
|
|
||||||
url = models.URLField(
|
url = models.URLField(
|
||||||
max_length=200,
|
max_length=200,
|
||||||
@@ -16,6 +29,10 @@ class ExternalLink(PlaceAsset):
|
|||||||
max_length=100,
|
max_length=100,
|
||||||
verbose_name=_('link text')
|
verbose_name=_('link text')
|
||||||
)
|
)
|
||||||
|
linktype = models.CharField(
|
||||||
class PhotoAlbum(ExternalLink):
|
choices=LINK_TYPES,
|
||||||
pass
|
max_length=20,
|
||||||
|
verbose_name=_('link type'),
|
||||||
|
blank=True,
|
||||||
|
null=True
|
||||||
|
)
|
||||||
|
@@ -104,7 +104,7 @@ class PlaceAsset(Submittable):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
place = models.ForeignKey(
|
place = models.ForeignKey(
|
||||||
Place,
|
Place,
|
||||||
|
@@ -104,16 +104,16 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class=" LP-Section">
|
<section class=" LP-Section">
|
||||||
<h1 class="LP-Headline">{% translate 'Photo albums submitted by' %} {{explorer.user.username}}</h1>
|
<h1 class="LP-Headline">{% translate 'External links submitted by' %} {{explorer.user.username}}</h1>
|
||||||
<div class="LP-LinkList">
|
<div class="LP-LinkList">
|
||||||
<ul class="LP-LinkList__Container">
|
<ul class="LP-LinkList__Container">
|
||||||
{% for photo_album in assets.photoalbums.all %}
|
{% for external_link in assets.externallinks.all %}
|
||||||
<li class="LP-LinkList__Item">
|
<li class="LP-LinkList__Item">
|
||||||
<a target="_blank" href="{{photo_album.url}}" class="LP-Link">
|
<a target="_blank" href="{{external_link.url}}" class="LP-Link">
|
||||||
<span class="LP-Text">{{photo_album.label}}</span>
|
<span class="LP-Text">{{external_link.label}}</span>
|
||||||
</a>
|
</a>
|
||||||
{% if user.explorer == photo_album.submitted_by%}
|
{% if user.explorer == external_link.submitted_by%}
|
||||||
<a href="{% url 'photo_album_delete' pk=photo_album.pk%}" class="LP-Link LP-LinkList__ItemHover" title="Delete Photo Album">
|
<a href="{% url 'external_link_delete' pk=external_link.pk%}" class="LP-Link LP-LinkList__ItemHover" title="Delete Photo Album">
|
||||||
<div class="RV-Iconized__Container RV-Iconized__Container--small">
|
<div class="RV-Iconized__Container RV-Iconized__Container--small">
|
||||||
{% icon 'trash' className="RV-Iconized__Icon" %}
|
{% icon 'trash' className="RV-Iconized__Icon" %}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{% extends 'global.html'%}
|
{% extends 'global.html'%}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}{% translate 'Submit a photo album' %}{% endblock %}
|
{% block title %}{% translate 'Submit an external link' %}{% endblock %}
|
||||||
|
|
||||||
{% block additional_menu_items %}
|
{% 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
|
<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 %}
|
{% block maincontent %}
|
||||||
<form class="LP-Form" method="POST">
|
<form class="LP-Form" method="POST">
|
||||||
<fieldset class="LP-Form__Fieldset">
|
<fieldset class="LP-Form__Fieldset">
|
||||||
<legend class="LP-Form__Legend">{% translate 'Submit a photo album for' %} {{place.name}}</legend>
|
<legend class="LP-Form__Legend">{% translate 'Submit an external link for' %} {{place.name}}</legend>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="LP-Form__Composition">
|
<div class="LP-Form__Composition">
|
||||||
<div class="LP-Form__Field">
|
<div class="LP-Form__Field">
|
||||||
@@ -27,9 +27,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</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">
|
<div class="LP-Form__Composition LP-Form__Composition--buttons">
|
||||||
{% include 'partials/form/submit.html' with referrer=request.META.HTTP_REFERER %}
|
{% include 'partials/form/submit.html' with referrer=request.META.HTTP_REFERER %}
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
{% endblock maincontent %}
|
{% endblock maincontent %}
|
@@ -62,16 +62,16 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class=" LP-Section">
|
<section class=" LP-Section">
|
||||||
<h1 class="LP-Headline">{% translate 'Photo albums' %}</h1>
|
<h2 class="LP-Headline">{% translate 'External links' %}</h2>
|
||||||
<div class="LP-LinkList">
|
<div class="LP-LinkList">
|
||||||
<ul class="LP-LinkList__Container">
|
<ul class="LP-LinkList__Container">
|
||||||
{% for photo_album in place.photoalbums.all %}
|
{% for external_link in place.externallinks.all %}
|
||||||
<li class="LP-LinkList__Item">
|
<li class="LP-LinkList__Item">
|
||||||
<a target="_blank" href="{{photo_album.url}}" class="LP-Link">
|
<a target="_blank" href="{{external_link.url}}" class="LP-Link">
|
||||||
<span class="LP-Text">{{photo_album.label}}</span>
|
<span class="LP-Text">{{external_link.label}}</span>
|
||||||
</a>
|
</a>
|
||||||
{% if user.explorer == photo_album.submitted_by or user.explorer == place.submitted_by %}
|
{% if user.explorer == external_link.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">
|
<a href="{% url 'external_link_delete' pk=external_link.pk%}" class="LP-Link LP-LinkList__ItemHover" title="Delete external link">
|
||||||
<div class="RV-Iconized__Container RV-Iconized__Container--small">
|
<div class="RV-Iconized__Container RV-Iconized__Container--small">
|
||||||
{% icon 'trash' className="RV-Iconized__Icon" %}
|
{% icon 'trash' className="RV-Iconized__Icon" %}
|
||||||
</div>
|
</div>
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<li class="LP-LinkList__Item">
|
<li class="LP-LinkList__Item">
|
||||||
<a href="{% url 'photo_album_create' place_id=place.id %}" class="LP-Link">
|
<a href="{% url 'external_link_create' place_id=place.id %}" class="LP-Link">
|
||||||
<div class="RV-Iconized__Container RV-Iconized__Container--small">
|
<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">
|
<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>
|
<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" />
|
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>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
<span class="RV-Iconized__Text">{% translate 'Add photo album' %}</span>
|
<span class="RV-Iconized__Text">{% translate 'Add external link' %}</span>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@@ -19,8 +19,8 @@ from lostplaces.views import (
|
|||||||
PlaceVisitDeleteView,
|
PlaceVisitDeleteView,
|
||||||
PlaceImageCreateView,
|
PlaceImageCreateView,
|
||||||
PlaceImageDeleteView,
|
PlaceImageDeleteView,
|
||||||
PhotoAlbumCreateView,
|
ExternalLinkCreateView,
|
||||||
PhotoAlbumDeleteView,
|
ExternalLinkDeleteView,
|
||||||
ExplorerProfileView,
|
ExplorerProfileView,
|
||||||
ExplorerProfileUpdateView
|
ExplorerProfileUpdateView
|
||||||
)
|
)
|
||||||
@@ -48,6 +48,6 @@ urlpatterns = [
|
|||||||
path('place_image/create/<int:place_id>/', PlaceImageCreateView.as_view(), name='place_image_create'),
|
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('place_image/delete/<int:pk>/', PlaceImageDeleteView.as_view(), name='place_image_delete'),
|
||||||
|
|
||||||
path('photo_album/create/<int:place_id>/', PhotoAlbumCreateView.as_view(), name='photo_album_create'),
|
path('external_link/create/<int:place_id>/', ExternalLinkCreateView.as_view(), name='external_link_create'),
|
||||||
path('photo_album/delete/<int:pk>/', PhotoAlbumDeleteView.as_view(), name='photo_album_delete')
|
path('external_link/delete/<int:pk>/', ExternalLinkDeleteView.as_view(), name='external_link_delete')
|
||||||
]
|
]
|
||||||
|
@@ -12,7 +12,7 @@ from django.http import HttpResponseForbidden
|
|||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from lostplaces.forms import SignupVoucherForm, TagSubmitForm
|
from lostplaces.forms import SignupVoucherForm, TagSubmitForm
|
||||||
from lostplaces.models import Place, PhotoAlbum
|
from lostplaces.models import Place, ExternalLink, external_links
|
||||||
from lostplaces.views.base_views import IsAuthenticatedMixin
|
from lostplaces.views.base_views import IsAuthenticatedMixin
|
||||||
from lostplaces.common import redirect_referer_or
|
from lostplaces.common import redirect_referer_or
|
||||||
|
|
||||||
@@ -48,17 +48,29 @@ class HomeView(IsAuthenticatedMixin, View):
|
|||||||
}
|
}
|
||||||
return render(self.request, 'home_unauth.html', context)
|
return render(self.request, 'home_unauth.html', context)
|
||||||
|
|
||||||
class PhotoAlbumCreateView(PlaceAssetCreateView):
|
class ExternalLinkCreateView(PlaceAssetCreateView):
|
||||||
model = PhotoAlbum
|
model = ExternalLink
|
||||||
fields = ['url', 'label']
|
fields = ['url', 'label', 'linktype']
|
||||||
template_name = 'photo_album/photo_album_create.html'
|
template_name = 'external_link/external_link_create.html'
|
||||||
success_message = _('Photo album link submitted')
|
success_message = _('External link submitted')
|
||||||
|
|
||||||
class PhotoAlbumDeleteView(PlaceAssetDeleteView):
|
def post(self, request, place_id, *args, **kwargs):
|
||||||
model = PhotoAlbum
|
response = super().post(request, place_id, *args, **kwargs)
|
||||||
|
if not self.object.linktype:
|
||||||
|
for domain, link_type in external_links.LINK_DOMAINS.items():
|
||||||
|
if domain in self.object.url:
|
||||||
|
self.object.linktype = link_type
|
||||||
|
self.object.save()
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
self.object.linktype = None
|
||||||
|
return response
|
||||||
|
|
||||||
|
class ExternalLinkDeleteView(PlaceAssetDeleteView):
|
||||||
|
model = ExternalLink
|
||||||
pk_url_kwarg = 'pk'
|
pk_url_kwarg = 'pk'
|
||||||
success_message = _('Photo album link deleted')
|
success_message = _('External link deleted')
|
||||||
permission_denied_messsage = _('You are not allowed to edit this photo album link')
|
permission_denied_messsage = _('You are not allowed to edit this external link')
|
||||||
|
|
||||||
class PlaceTagSubmitView(IsAuthenticatedMixin, View):
|
class PlaceTagSubmitView(IsAuthenticatedMixin, View):
|
||||||
def post(self, request, tagged_id, *args, **kwargs):
|
def post(self, request, tagged_id, *args, **kwargs):
|
||||||
|
Reference in New Issue
Block a user