add title to galleries

This commit is contained in:
Frédéric Péters 2015-05-31 14:03:06 +02:00
parent 134ce73db1
commit 72a80d98cd
3 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('gallery', '0002_image_title'),
]
operations = [
migrations.AddField(
model_name='gallerycell',
name='title',
field=models.CharField(max_length=50, null=True, verbose_name='Title', blank=True),
preserve_default=True,
),
]

View File

@ -24,6 +24,7 @@ from combo.data.library import register_cell_class
@register_cell_class
class GalleryCell(CellBase):
title = models.CharField(_('Title'), max_length=50, blank=True, null=True)
manager_form_template = 'combo/gallery_manager.html'
class Meta:

View File

@ -2,6 +2,10 @@
{% load static thumbnail i18n %}
{% block cell-form %}
<form action="{{ url }}" method="post" data-label-url="{% url 'combo-manager-page-get-additional-label' page_pk=page.id cell_reference=cell.get_reference %}">
{% csrf_token %}
{{ form.as_p }}
<ul class="gallery" id="gallery-{{cell.id}}" data-order-url="{% url 'combo-gallery-image-order' gallery_pk=cell.id %}">
{% for image in cell.image_set.all %}
<li data-object-id="{{image.id}}">
@ -26,4 +30,5 @@
<a class="image-add" rel="popup" href="{% url 'combo-gallery-image-add' gallery_pk=cell.id %}">{% trans 'New Image' %}</a>
|
{{ block.super }}
</form>
{% endblock %}