Move custom photologue to seperate app

This commit is contained in:
Alexandre Iooss 2021-09-23 10:17:01 +02:00
parent 0edbc79023
commit 59b95898f8
13 changed files with 59 additions and 13 deletions

View file

@ -41,6 +41,7 @@ INSTALLED_APPS = [
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'photologue_custom',
'photologue',
'sortedm2m',
]

View file

View file

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View file

@ -0,0 +1,5 @@
from django.apps import AppConfig
class PhotologueCustomConfig(AppConfig):
name = 'photologue_custom'

View file

View file

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

View file

@ -21,18 +21,15 @@
{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-12">
<h1>{{ gallery.title }}</h1>
<p class="text-muted small">{% trans "Published" %} {{ gallery.date_added }}</p>
{% if gallery.description %}<p>{{ gallery.description|safe }}</p>{% endif %}
<div class="gallery-list" id="lightgallery">
<div class="gallery-list mb-3" id="lightgallery">
{% for photo in gallery.public %}
<a href="{{ photo.get_absolute_url }}" data-src="{{ photo.get_display_url }}" data-download-url="{{ photo.image.url }}">
<img src="{{ photo.get_thumbnail_url }}" class="img-thumbnail" alt="{{ photo.title }}">
</a>
{% endfor %}
</div>
</div>
</div>
<a href="#" class="btn btn-secondary">{% trans 'Download all gallery' %}</a>
{% endblock %}

View file

@ -0,0 +1,31 @@
{% extends "photologue/root.html" %}
{% load photologue_tags i18n %}
{% block title %}{{ object.title }}{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-12">
<h1>{{ object.title }}</h1>
<p class="text-muted small">{% trans "Published" %} {{ object.date_added }}</p>
</div>
</div>
<div class="row">
<div class="col-md-8">
{% if object.caption %}<p>{{ object.caption|safe }}</p>{% endif %}
<a href="{{ object.image.url }}">
<img src="{{ object.get_display_url }}" class="img-thumbnail" alt="{{ object.title }}">
</a>
</div>
<div class="col-md-4">
{% if object.public_galleries %}
<p>{% trans "This photo is found in the following galleries" %}:</p>
<ul>
{% for gallery in object.public_galleries %}
<li><a href="{{ gallery.get_absolute_url }}">{{ gallery.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View file

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.