manager: basic views to create/list/edit pages
This commit is contained in:
parent
a5c9062229
commit
4628509fd4
|
@ -0,0 +1,6 @@
|
|||
{% extends "gadjo/base.html" %}
|
||||
|
||||
{% block page-title %}Combo{% endblock %}
|
||||
{% block site-title %}Combo{% endblock %}
|
||||
{% block footer %}Combo — Copyright © Entr'ouvert{% endblock %}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
{% extends "combo/manager_base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<a href="{% url 'combo-manager-pages-list' %}">Pages</a>
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,18 @@
|
|||
{% extends "combo/manager_base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<div class="buttons">
|
||||
<button>{% trans "Save" %}</button>
|
||||
{% if object.id %}
|
||||
<a class="cancel" href="{{ object.get_absolute_url }}">{% trans 'Cancel' %}</a>
|
||||
{% else %}
|
||||
<a class="cancel" href="{% url 'combo-manager-pages-list' %}">{% trans 'Cancel' %}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
|
@ -0,0 +1,10 @@
|
|||
{% extends "combo/manager_base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block appbar %}
|
||||
<h2>Page - {{ object.title }}</h2>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,13 @@
|
|||
{% extends "combo/manager_base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<ul>
|
||||
{% for page in object_list %}
|
||||
<li><a href="{% url 'combo-manager-page-view' pk=page.id %}">{{ page.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<a href="{% url 'combo-manager-page-add' %}">+</a>
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,28 @@
|
|||
# combo - content management system
|
||||
# Copyright (C) 2014 Entr'ouvert
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Affero General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from django.conf.urls import patterns, url, include
|
||||
|
||||
from . import views
|
||||
|
||||
|
||||
urlpatterns = patterns('combo.views',
|
||||
url(r'^$', views.homepage, name='combo-manager-homepage'),
|
||||
url(r'^pages/$', views.pages_list, name='combo-manager-pages-list'),
|
||||
url(r'^pages/add/$', views.page_add, name='combo-manager-page-add'),
|
||||
url(r'^pages/(?P<pk>\w+)/$', views.page_view,
|
||||
name='combo-manager-page-view'),
|
||||
)
|
|
@ -1,3 +1,46 @@
|
|||
from django.shortcuts import render
|
||||
# combo - content management system
|
||||
# Copyright (C) 2014 Entr'ouvert
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Affero General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Create your views here.
|
||||
from django.views.generic import TemplateView, DetailView, CreateView, ListView
|
||||
|
||||
from combo.data.models import Page
|
||||
|
||||
|
||||
class HomepageView(TemplateView):
|
||||
template_name = 'combo/manager_home.html'
|
||||
|
||||
homepage = HomepageView.as_view()
|
||||
|
||||
|
||||
class PagesListView(ListView):
|
||||
model = Page
|
||||
template_name = 'combo/pages_list.html'
|
||||
|
||||
pages_list = PagesListView.as_view()
|
||||
|
||||
|
||||
class PageAddView(CreateView):
|
||||
model = Page
|
||||
template_name = 'combo/page_add.html'
|
||||
|
||||
page_add = PageAddView.as_view()
|
||||
|
||||
|
||||
class PageView(DetailView):
|
||||
model = Page
|
||||
template_name = 'combo/page_view.html'
|
||||
|
||||
page_view = PageView.as_view()
|
||||
|
|
|
@ -37,7 +37,9 @@ INSTALLED_APPS = (
|
|||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'ckeditor',
|
||||
'gadjo',
|
||||
'combo.data',
|
||||
'combo.manager',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
|
@ -49,6 +51,12 @@ MIDDLEWARE_CLASSES = (
|
|||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
)
|
||||
|
||||
# Serve xstatic files, required for gadjo
|
||||
from django.conf import global_settings
|
||||
STATICFILES_FINDERS = global_settings.STATICFILES_FINDERS + \
|
||||
('gadjo.finders.XStaticFinder',)
|
||||
|
||||
|
||||
ROOT_URLCONF = 'combo.urls'
|
||||
|
||||
WSGI_APPLICATION = 'combo.wsgi.application'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from django.conf.urls import patterns, include, url
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^manage/', include('combo.manager.urls')),
|
||||
)
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
Django==1.6
|
||||
django-ckeditor
|
||||
-e git+http://repos.entrouvert.org/gadjo.git/#egg=gadjo
|
||||
|
|
Loading…
Reference in New Issue