empty shell
This commit is contained in:
parent
4a0fe5d416
commit
e5d5aa9b48
|
@ -0,0 +1,6 @@
|
|||
recursive-include passerelle_montpellier_encombrants/static *.css *.png
|
||||
recursive-include passerelle_montpellier_encombrants/templates *.html *.txt
|
||||
recursive-include passerelle_montpellier_encombrants/locale *.po *.mo
|
||||
include MANIFEST.in
|
||||
include COPYING
|
||||
include VERSION
|
|
@ -0,0 +1,25 @@
|
|||
# passerelle-montpellier-encombrants
|
||||
# Copyright (C) 2015 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.utils.translation import ugettext as _
|
||||
|
||||
class Plugin(object):
|
||||
def get_apps(self):
|
||||
return [__name__]
|
||||
|
||||
def get_after_urls(self):
|
||||
from . import urls
|
||||
return urls.urlpatterns
|
|
@ -0,0 +1,35 @@
|
|||
# passerelle-montpellier-encombrants
|
||||
# Copyright (C) 2015 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.utils.text import slugify
|
||||
from django import forms
|
||||
|
||||
from .models import EncombrantsManagement
|
||||
|
||||
class EncombrantsManagementForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = EncombrantsManagement
|
||||
exclude = ('slug', 'users')
|
||||
|
||||
def save(self, commit=True):
|
||||
if not self.instance.slug:
|
||||
self.instance.slug = slugify(self.instance.title)
|
||||
return super(EncombrantsManagementForm, self).save(commit=commit)
|
||||
|
||||
class EncombrantsManagementUpdateForm(EncombrantsManagementForm):
|
||||
class Meta:
|
||||
model = EncombrantsManagement
|
||||
exclude = ('users',)
|
|
@ -0,0 +1,28 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('base', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='EncombrantsManagement',
|
||||
fields=[
|
||||
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||
('title', models.CharField(max_length=50)),
|
||||
('slug', models.SlugField()),
|
||||
('description', models.TextField()),
|
||||
('users', models.ManyToManyField(to='base.ApiUser', blank=True)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Gestion des encombrants Montpellier',
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,42 @@
|
|||
# passerelle-montpellier-encombrants
|
||||
# Copyright (C) 2015 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.core.urlresolvers import reverse
|
||||
from django.db import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from passerelle.base.models import BaseResource
|
||||
|
||||
class EncombrantsManagement(BaseResource):
|
||||
category = _('Business Process Connectors')
|
||||
|
||||
class Meta:
|
||||
verbose_name = 'Gestion des encombrants Montpellier'
|
||||
|
||||
@classmethod
|
||||
def get_icon_class(cls):
|
||||
return 'ressources'
|
||||
|
||||
@classmethod
|
||||
def get_verbose_name(cls):
|
||||
return cls._meta.verbose_name
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse('montpellier-encombrants-view', kwargs={'slug': self.slug})
|
||||
|
||||
@classmethod
|
||||
def get_add_url(cls):
|
||||
return reverse('montpellier-encombrants-add')
|
|
@ -0,0 +1,8 @@
|
|||
{% extends "passerelle/manage.html" %}
|
||||
|
||||
{% block more-user-links %}
|
||||
{{ block.super }}
|
||||
{% if object.id %}
|
||||
<a href="{% url 'montpellier-encombrants-view' slug=object.slug %}">{{ object.title }}</a>
|
||||
{% endif %}
|
||||
{% endblock %}
|
|
@ -0,0 +1,42 @@
|
|||
{% extends "passerelle_montpellier_encombrants/base.html" %}
|
||||
{% load i18n passerelle %}
|
||||
|
||||
{% block appbar %}
|
||||
<h2>Encombrants Montpellier - {{ object.title }}</h2>
|
||||
{% if perms.passerelle_montpellier_encombrants.change_passerelle_montpellier_encombrants %}
|
||||
<a rel="popup" class="button" href="{% url 'montpellier-encombrants-edit' slug=object.slug %}">{% trans 'edit' %}</a>
|
||||
{% endif %}
|
||||
{% if perms.passerelle_montpellier_encombrants.delete_passerelle_montpellier_encombrants %}
|
||||
<a rel="popup" class="button" href="{% url 'montpellier-encombrants-delete' slug=object.slug %}">{% trans 'delete' %}</a>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if perms.passerelle_montpellier_encombrants.change_passerelle_montpellier_encombrants %}
|
||||
<div>
|
||||
<h3>{% trans "Management" %}</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="{% url 'montpellier-encombrants-sectors-listing' slug=object.slug %}">{% trans 'Sectors' %}</a></li>
|
||||
<li><a href="{% url 'montpellier-encombrants-communes-listing' slug=object.slug %}">{% trans 'Communes' %}</a></li>
|
||||
<li><a href="{% url 'montpellier-encombrants-collectdays-listing' slug=object.slug %}">{% trans 'Collect Days' %}</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if perms.base.view_accessright %}
|
||||
<div>
|
||||
<h3>{% trans "Security" %}</h3>
|
||||
|
||||
<p>
|
||||
{% trans 'Accessing the listings is open, but posting requests is limited to the following API users:' %}
|
||||
</p>
|
||||
|
||||
{% access_rights_table resource=object permission='can_post_request' %}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,44 @@
|
|||
# passerelle-montpellier-encombrants
|
||||
# Copyright (C) 2015 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, include, url
|
||||
from passerelle.urls_utils import decorated_includes, required, app_enabled
|
||||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
from .views import *
|
||||
|
||||
public_urlpatterns = patterns('',
|
||||
url(r'^(?P<slug>[\w,-]+)/$', EncombrantsManagementDetailView.as_view(),
|
||||
name='montpellier-encombrants-view'),
|
||||
)
|
||||
|
||||
management_urlpatterns = patterns('',
|
||||
url(r'^add$', EncombrantsManagementCreateView.as_view(),
|
||||
name='montpellier-encombrants-add'),
|
||||
url(r'^(?P<slug>[\w,-]+)/edit$', EncombrantsManagementUpdateView.as_view(),
|
||||
name='montpellier-encombrants-edit'),
|
||||
url(r'^(?P<slug>[\w,-]+)/delete$', EncombrantsManagementDeleteView.as_view(),
|
||||
name='montpellier-encombrants-delete'),
|
||||
)
|
||||
|
||||
urlpatterns = required(
|
||||
app_enabled('passerelle_montpellier_encombrants'),
|
||||
patterns('',
|
||||
url(r'^montpellier-encombrants/', include(public_urlpatterns)),
|
||||
url(r'^manage/montpellier-encombrants/',
|
||||
decorated_includes(login_required, include(management_urlpatterns))),
|
||||
)
|
||||
)
|
|
@ -0,0 +1,48 @@
|
|||
# passerelle-montpellier-encombrants
|
||||
# Copyright (C) 2015 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.core.urlresolvers import reverse
|
||||
from django.views.generic.detail import DetailView
|
||||
from django.views.generic.edit import CreateView, UpdateView, DeleteView
|
||||
|
||||
from passerelle import utils
|
||||
|
||||
from .models import EncombrantsManagement
|
||||
from .forms import EncombrantsManagementForm, EncombrantsManagementUpdateForm
|
||||
|
||||
class EncombrantsManagementDetailView(DetailView):
|
||||
model = EncombrantsManagement
|
||||
template_name = 'passerelle_montpellier_encombrants/detail.html'
|
||||
|
||||
|
||||
class EncombrantsManagementCreateView(CreateView):
|
||||
model = EncombrantsManagement
|
||||
form_class = EncombrantsManagementForm
|
||||
template_name = 'passerelle/manage/service_form.html'
|
||||
|
||||
|
||||
class EncombrantsManagementUpdateView(UpdateView):
|
||||
model = EncombrantsManagement
|
||||
form_class = EncombrantsManagementUpdateForm
|
||||
template_name = 'passerelle/manage/service_form.html'
|
||||
|
||||
|
||||
class EncombrantsManagementDeleteView(DeleteView):
|
||||
model = EncombrantsManagement
|
||||
template_name = 'passerelle/manage/service_confirm_delete.html'
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse('manage-home')
|
|
@ -0,0 +1,108 @@
|
|||
#! /usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from setuptools.command.install_lib import install_lib as _install_lib
|
||||
from distutils.command.build import build as _build
|
||||
from distutils.command.sdist import sdist
|
||||
from distutils.cmd import Command
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
class eo_sdist(sdist):
|
||||
def run(self):
|
||||
if os.path.exists('VERSION'):
|
||||
os.remove('VERSION')
|
||||
version = get_version()
|
||||
version_file = open('VERSION', 'w')
|
||||
version_file.write(version)
|
||||
version_file.close()
|
||||
sdist.run(self)
|
||||
if os.path.exists('VERSION'):
|
||||
os.remove('VERSION')
|
||||
|
||||
def get_version():
|
||||
if os.path.exists('VERSION'):
|
||||
version_file = open('VERSION', 'r')
|
||||
version = version_file.read()
|
||||
version_file.close()
|
||||
return version
|
||||
if os.path.exists('.git'):
|
||||
p = subprocess.Popen(['git', 'describe', '--dirty', '--match=v*'], stdout=subprocess.PIPE)
|
||||
result = p.communicate()[0]
|
||||
if p.returncode == 0:
|
||||
version = result.split()[0][1:]
|
||||
version = version.replace('-', '.')
|
||||
return version
|
||||
return '0'
|
||||
|
||||
|
||||
class compile_translations(Command):
|
||||
description = 'compile message catalogs to MO files via django compilemessages'
|
||||
user_options = []
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
from django.core.management import call_command
|
||||
for path, dirs, files in os.walk('passerelle_montpellier_encombrants'):
|
||||
if 'locale' not in dirs:
|
||||
continue
|
||||
curdir = os.getcwd()
|
||||
os.chdir(os.path.realpath(path))
|
||||
call_command('compilemessages')
|
||||
os.chdir(curdir)
|
||||
except ImportError:
|
||||
sys.stderr.write('!!! Please install Django >= 1.4 to build translations\n')
|
||||
|
||||
|
||||
class build(_build):
|
||||
sub_commands = [('compile_translations', None)] + _build.sub_commands
|
||||
|
||||
|
||||
class install_lib(_install_lib):
|
||||
def run(self):
|
||||
self.run_command('compile_translations')
|
||||
_install_lib.run(self)
|
||||
|
||||
|
||||
setup(
|
||||
name='passerelle-montpellier-encombrants',
|
||||
version=get_version(),
|
||||
author='Frederic Peters',
|
||||
author_email='fpeters@entrouvert.com',
|
||||
packages=find_packages(),
|
||||
include_package_data=True,
|
||||
url='https://dev.entrouvert.org/projects/teleservices-agglo-montpellier/',
|
||||
classifiers=[
|
||||
'Development Status :: 2 - Pre-Alpha',
|
||||
'Environment :: Web Environment',
|
||||
'Framework :: Django',
|
||||
'Intended Audience :: Developers',
|
||||
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
|
||||
'Operating System :: OS Independent',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 2',
|
||||
],
|
||||
install_requires=['django>=1.7, <1.8',
|
||||
],
|
||||
zip_safe=False,
|
||||
entry_points={
|
||||
'passerelle.plugin': ['passerelle_montpellier_encombrants = passerelle_montpellier_encombrants:Plugin'],
|
||||
},
|
||||
cmdclass={
|
||||
'build': build,
|
||||
'compile_translations': compile_translations,
|
||||
'install_lib': install_lib,
|
||||
'sdist': eo_sdist,
|
||||
}
|
||||
)
|
Loading…
Reference in New Issue