From 9837dbeab34344bd323acf395bb31a63754e71d7 Mon Sep 17 00:00:00 2001 From: Andreas Frisch Date: Fri, 27 Mar 2020 12:16:27 +0100 Subject: [PATCH] Initial Commit --- .gitignore | 63 +++++++++++++++++++ .isort.cfg | 10 +++ LICENSE | 13 ++++ MANIFEST.in | 3 + README.rst | 30 +++++++++ byro-schaffenburg/__init__.py | 20 ++++++ .../locale/de/LC_MESSAGES/django.po | 12 ++++ byro-schaffenburg/models.py | 27 ++++++++ byro-schaffenburg/pylama.ini | 3 + byro-schaffenburg/signals.py | 1 + .../static/byro-schaffenburg/.gitkeep | 0 .../templates/byro-schaffenburg/.gitkeep | 0 pylama.ini | 3 + pytest.ini | 2 + setup.py | 44 +++++++++++++ 15 files changed, 231 insertions(+) create mode 100644 .gitignore create mode 100644 .isort.cfg create mode 100644 LICENSE create mode 100644 MANIFEST.in create mode 100644 README.rst create mode 100644 byro-schaffenburg/__init__.py create mode 100644 byro-schaffenburg/locale/de/LC_MESSAGES/django.po create mode 100644 byro-schaffenburg/models.py create mode 100644 byro-schaffenburg/pylama.ini create mode 100644 byro-schaffenburg/signals.py create mode 100644 byro-schaffenburg/static/byro-schaffenburg/.gitkeep create mode 100644 byro-schaffenburg/templates/byro-schaffenburg/.gitkeep create mode 100644 pylama.ini create mode 100644 pytest.ini create mode 100644 setup.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d95f781 --- /dev/null +++ b/.gitignore @@ -0,0 +1,63 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg +.ropeproject/ + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints diff --git a/.isort.cfg b/.isort.cfg new file mode 100644 index 0000000..9b4a582 --- /dev/null +++ b/.isort.cfg @@ -0,0 +1,10 @@ +[isort] +balanced_wrapping = True +combine_as_imports = True +default_section = THIRDPARTY +include_trailing_comma = True +known_first_party = byro +line_length = 80 +multi_line_output = 5 +not_skip = __init__.py +skip = migrations,settings.py,wsgi.py,celery_app.py diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..38d3391 --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +Copyright 2020 Fraxinas + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..d680de9 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +recursive-include byro-schaffenburg/static * +recursive-include byro-schaffenburg/templates * +recursive-include byro-schaffenburg/locale * diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..7f28cf5 --- /dev/null +++ b/README.rst @@ -0,0 +1,30 @@ +Schaffenburg e.V. Byro Plugin +========================== + +This is a plugin for `byro`_. + +Development setup +----------------- + +1. Make sure that you have a working byro development setup`. + +2. Clone this repository, eg to ``local/byro-schaffenburg``. + +3. Activate the virtual environment you use for byro development. + +4. Execute ``python setup.py develop`` within this directory to register this application with byro's plugin registry. + +5. Restart your local byro server. The plugin is now in use. + +6. To generate local translation files: ``django-admin makemessages -l de -i build -i dist -i "*egg*"`` + + +License +------- + +Copyright 2020 Fraxinas + +Released under the terms of the Apache License 2.0 + + +.. _byro: https://github.com/byro/byro diff --git a/byro-schaffenburg/__init__.py b/byro-schaffenburg/__init__.py new file mode 100644 index 0000000..885737d --- /dev/null +++ b/byro-schaffenburg/__init__.py @@ -0,0 +1,20 @@ +from django.apps import AppConfig +from django.utils.translation import ugettext_lazy + + +class PluginApp(AppConfig): + name = 'byro-schaffenburg' + verbose_name = 'Schaffenburg e.V. Byro Plugin' + + class ByroPluginMeta: + name = ugettext_lazy('Schaffenburg e.V. Byro Plugin') + author = 'Fraxinas' + description = ugettext_lazy('Membership info extensions for Makerspace Schaffenburg') + visible = True + version = '0.0.1' + + def ready(self): + from . import signals # NOQA + + +default_app_config = 'byro-schaffenburg.PluginApp' diff --git a/byro-schaffenburg/locale/de/LC_MESSAGES/django.po b/byro-schaffenburg/locale/de/LC_MESSAGES/django.po new file mode 100644 index 0000000..b797c49 --- /dev/null +++ b/byro-schaffenburg/locale/de/LC_MESSAGES/django.po @@ -0,0 +1,12 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-03-07 19:01+0100\n" +"PO-Revision-Date: \n" +"Last-Translator: Fraxinas\n" +"Language-Team: \n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" diff --git a/byro-schaffenburg/models.py b/byro-schaffenburg/models.py new file mode 100644 index 0000000..593bde4 --- /dev/null +++ b/byro-schaffenburg/models.py @@ -0,0 +1,27 @@ +from annoying.fields import AutoOneToOneField +from django.db import models + +class MembershipTypes(Choices): + FULL = "Vollmitglied" + SUPP = "Fördermitglied" + +class SchaffenProfile(models.Model): + member = AutoOneToOneField( + to='members.Member', + on_delete=models.CASCADE, + related_name='profile_schaffenburg', + ) + membership_type = models.CharField( + max_length=MembershipTypes.max_length, + verbose_name=_("Art der Mitgliedschaft"), + choices=MembershipTypes.choices, + default=MembershipTypes.FULL, + ) + is_keyholder = models.BooleanField( + default=False, + verbose_name=_("Ist schließberechtigt"), + ) + has_physical_key = models.BooleanField( + default=False, + verbose_name=_("Besitzt physischen Schlüssel"), + ) diff --git a/byro-schaffenburg/pylama.ini b/byro-schaffenburg/pylama.ini new file mode 100644 index 0000000..b7229df --- /dev/null +++ b/byro-schaffenburg/pylama.ini @@ -0,0 +1,3 @@ +[pylama] +ignore = E501, +skip = */settings.py,*/migrations/*,manage.py diff --git a/byro-schaffenburg/signals.py b/byro-schaffenburg/signals.py new file mode 100644 index 0000000..a025794 --- /dev/null +++ b/byro-schaffenburg/signals.py @@ -0,0 +1 @@ +# Register your receivers here diff --git a/byro-schaffenburg/static/byro-schaffenburg/.gitkeep b/byro-schaffenburg/static/byro-schaffenburg/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/byro-schaffenburg/templates/byro-schaffenburg/.gitkeep b/byro-schaffenburg/templates/byro-schaffenburg/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/pylama.ini b/pylama.ini new file mode 100644 index 0000000..7541b7c --- /dev/null +++ b/pylama.ini @@ -0,0 +1,3 @@ +[pylama] +ignore = E501, +skip = */migrations/* diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..709355c --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +DJANGO_SETTINGS_MODULE = byro.settings diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..aec9bd7 --- /dev/null +++ b/setup.py @@ -0,0 +1,44 @@ +import os +from distutils.command.build import build + +from django.core import management +from setuptools import setup, find_packages + + +try: + with open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8') as f: + long_description = f.read() +except: + long_description = '' + + +class CustomBuild(build): + def run(self): + management.call_command('compilemessages', verbosity=1, interactive=False) + build.run(self) + + +cmdclass = { + 'build': CustomBuild +} + + +setup( + name='byro-schaffenburg', + version='0.0.1', + description='Membership info extensions for Makerspace Schaffenburg', + long_description=long_description, + url='https://git.schaffenburg.org/fraxinas/byro-schaffenburg', + author='Fraxinas', + author_email='fraxinas@schaffenburg.org', + license='Apache Software License', + + install_requires=[], + packages=find_packages(exclude=['tests', 'tests.*']), + include_package_data=True, + cmdclass=cmdclass, + entry_points=""" +[byro.plugin] +byro-schaffenburg=byro-schaffenburg:ByroPluginMeta +""", +)