diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..04df9ff
--- /dev/null
+++ b/MANIFEST.in
@@ -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
diff --git a/passerelle_montpellier_encombrants/__init__.py b/passerelle_montpellier_encombrants/__init__.py
new file mode 100644
index 0000000..472efc0
--- /dev/null
+++ b/passerelle_montpellier_encombrants/__init__.py
@@ -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 .
+
+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
diff --git a/passerelle_montpellier_encombrants/forms.py b/passerelle_montpellier_encombrants/forms.py
new file mode 100644
index 0000000..9cc8843
--- /dev/null
+++ b/passerelle_montpellier_encombrants/forms.py
@@ -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 .
+
+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',)
diff --git a/passerelle_montpellier_encombrants/migrations/0001_initial.py b/passerelle_montpellier_encombrants/migrations/0001_initial.py
new file mode 100644
index 0000000..1fe70c6
--- /dev/null
+++ b/passerelle_montpellier_encombrants/migrations/0001_initial.py
@@ -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,),
+ ),
+ ]
diff --git a/passerelle_montpellier_encombrants/migrations/__init__.py b/passerelle_montpellier_encombrants/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/passerelle_montpellier_encombrants/models.py b/passerelle_montpellier_encombrants/models.py
new file mode 100644
index 0000000..9f581fb
--- /dev/null
+++ b/passerelle_montpellier_encombrants/models.py
@@ -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 .
+
+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')
diff --git a/passerelle_montpellier_encombrants/templates/passerelle_montpellier_encombrants/base.html b/passerelle_montpellier_encombrants/templates/passerelle_montpellier_encombrants/base.html
new file mode 100644
index 0000000..827d71a
--- /dev/null
+++ b/passerelle_montpellier_encombrants/templates/passerelle_montpellier_encombrants/base.html
@@ -0,0 +1,8 @@
+{% extends "passerelle/manage.html" %}
+
+{% block more-user-links %}
+{{ block.super }}
+{% if object.id %}
+{{ object.title }}
+{% endif %}
+{% endblock %}
diff --git a/passerelle_montpellier_encombrants/templates/passerelle_montpellier_encombrants/detail.html b/passerelle_montpellier_encombrants/templates/passerelle_montpellier_encombrants/detail.html
new file mode 100644
index 0000000..98c2558
--- /dev/null
+++ b/passerelle_montpellier_encombrants/templates/passerelle_montpellier_encombrants/detail.html
@@ -0,0 +1,42 @@
+{% extends "passerelle_montpellier_encombrants/base.html" %}
+{% load i18n passerelle %}
+
+{% block appbar %}
+
Encombrants Montpellier - {{ object.title }}
+{% if perms.passerelle_montpellier_encombrants.change_passerelle_montpellier_encombrants %}
+{% trans 'edit' %}
+{% endif %}
+{% if perms.passerelle_montpellier_encombrants.delete_passerelle_montpellier_encombrants %}
+{% trans 'delete' %}
+{% endif %}
+{% endblock %}
+
+{% block content %}
+
+{% if perms.passerelle_montpellier_encombrants.change_passerelle_montpellier_encombrants %}
+
+
{% trans "Management" %}
+
+
+
+
+{% endif %}
+
+{% if perms.base.view_accessright %}
+
+
{% trans "Security" %}
+
+
+{% trans 'Accessing the listings is open, but posting requests is limited to the following API users:' %}
+
+
+{% access_rights_table resource=object permission='can_post_request' %}
+{% endif %}
+
+
+
+{% endblock %}
diff --git a/passerelle_montpellier_encombrants/urls.py b/passerelle_montpellier_encombrants/urls.py
new file mode 100644
index 0000000..a076913
--- /dev/null
+++ b/passerelle_montpellier_encombrants/urls.py
@@ -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 .
+
+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[\w,-]+)/$', EncombrantsManagementDetailView.as_view(),
+ name='montpellier-encombrants-view'),
+)
+
+management_urlpatterns = patterns('',
+ url(r'^add$', EncombrantsManagementCreateView.as_view(),
+ name='montpellier-encombrants-add'),
+ url(r'^(?P[\w,-]+)/edit$', EncombrantsManagementUpdateView.as_view(),
+ name='montpellier-encombrants-edit'),
+ url(r'^(?P[\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))),
+ )
+)
diff --git a/passerelle_montpellier_encombrants/views.py b/passerelle_montpellier_encombrants/views.py
new file mode 100644
index 0000000..84afc1f
--- /dev/null
+++ b/passerelle_montpellier_encombrants/views.py
@@ -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 .
+
+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')
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..7da2559
--- /dev/null
+++ b/setup.py
@@ -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,
+ }
+)