From 7cb17d9d09e81ed5245d35d44c300f3b350024a8 Mon Sep 17 00:00:00 2001 From: benzkji Date: Mon, 6 Nov 2017 16:28:21 +0100 Subject: [PATCH 1/5] travis --- .travis.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e4ccc60 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,23 @@ +language: python + +python: + - "2.7" + - "3.4" + - "3.5" + +env: + matrix: + - DJANGO=1.7.8 DB=sqlite + - DJANGO=1.8.18 DB=sqlite + - DJANGO=1.9.5 DB=sqlite + - DJANGO=1.10.5 DB=sqlite + - DJANGO=1.11.3 DB=sqlite + +# command to install dependencies +install: + - pip install . + - pip install -q Django==$DJANGO + - pip install -r test_requirements.txt + +# command to run tests +script: python manage.py test \ No newline at end of file From 9828c80e3dfbf51be8267652a2362a36e03e0f46 Mon Sep 17 00:00:00 2001 From: benzkji Date: Mon, 6 Nov 2017 16:30:05 +0100 Subject: [PATCH 2/5] travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e4ccc60..a531b60 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,4 +20,4 @@ install: - pip install -r test_requirements.txt # command to run tests -script: python manage.py test \ No newline at end of file +script: python manage.py test From 48bd96cef9cc90e36c50ff7fa3bfd69d66529c7d Mon Sep 17 00:00:00 2001 From: benzkji Date: Mon, 6 Nov 2017 16:36:26 +0100 Subject: [PATCH 3/5] optics --- PYPI.rst | 9 ++++++++- README.md | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/PYPI.rst b/PYPI.rst index 5f1ba23..e1d45c0 100644 --- a/PYPI.rst +++ b/PYPI.rst @@ -1,4 +1,11 @@ django-separate-users --------------------- -https://github.com/bnzk/django-separate-users +.. image:: https://travis-ci.org/bnzk/django-separate-users.svg + :target: https://travis-ci.org/bnzk/django-separate-users/ +.. image:: https://img.shields.io/pypi/v/django-separate-users.svg + :target: https://pypi.python.org/pypi/django-separate-users/ +.. image:: https://img.shields.io/pypi/l/django-separate-users.svg + :target: https://pypi.python.org/pypi/django-separate-users/ + +Development and Docs on https://github.com/bnzk/django-separate-users diff --git a/README.md b/README.md index 452a3c6..e67c6c7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # django-separate-users +[![Build Status](https://travis-ci.org/bnzk/django-separate-users.svg "Build Status")](https://travis-ci.org/bnzk/django-separate-users/) +[![PyPi Version](https://img.shields.io/pypi/v/django-separate-users.svg "PyPi Version")](https://pypi.python.org/pypi/django-separate-users/) +[![Licence](https://img.shields.io/pypi/l/django-separate-users.svg "Licence")](https://pypi.python.org/pypi/django-separate-users/) + Separate staff and non staff users with two proxy models (FrontendUser and Editor). Nothing fancy, but as I ended up doing this again and again, this is a simple plug and forget solution, that I'll probably use in many projects from now on. From fd7e729baee3c7d534fb683cdb8933bdcef6bb7b Mon Sep 17 00:00:00 2001 From: benzkji Date: Mon, 6 Nov 2017 16:40:34 +0100 Subject: [PATCH 4/5] optics --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e67c6c7..a1cc4fb 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,16 @@ solution, that I'll probably use in many projects from now on. - minimal requirement are the `is_staff` and `is_superuser` fields on your user model - staff users can be given the right to edit non staff users (currently not possible, or everyone can make everyone a superuser) -- fieldsets for staff and non staff users can be defined via settings (not yet) - better admin list views (filters, is_active, etc) [//]: # (NOTE / WARNING: With django<1.11, it's not possible to run this app with as custom `settings.AUTH_USER_MODEL`. See https://stackoverflow.com/questions/46935758/djangos-get-user-model-only-in-1-11-during-import-time t) -NOTE: Custom user models are not supported (yet). +### TODO + +- custom user models support. if you could help, would be nice: #3 +- fieldsets for staff and non staff users can be defined via settings (not yet) ## Usage From 68ad26fc12042ac1212e555d894217b699731131 Mon Sep 17 00:00:00 2001 From: benzkji Date: Tue, 1 May 2018 17:30:33 +0200 Subject: [PATCH 5/5] django 2.0 on the way --- CHANGELOG.txt | 2 ++ makemessages.sh | 5 ---- separate_users/tests/settings.py | 2 ++ .../tests/test_app/migrations/0001_initial.py | 4 +-- separate_users/tests/test_permissions.py | 11 +++++-- separate_users/tests/urls.py | 4 +-- setup.py | 2 +- tox.ini | 30 +++++-------------- compilemessages.sh => translations.sh | 2 ++ 9 files changed, 28 insertions(+), 34 deletions(-) delete mode 100755 makemessages.sh rename compilemessages.sh => translations.sh (53%) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ecb4cfa..834df41 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -7,3 +7,5 @@ ==== 0.0.1 === - initial release +- support for django 1.11+ +- support for custom user model still experimental, as nobody uses this, and it's hard to test. diff --git a/makemessages.sh b/makemessages.sh deleted file mode 100755 index d0185b4..0000000 --- a/makemessages.sh +++ /dev/null @@ -1,5 +0,0 @@ - - -cd separate_users -django-admin.py makemessages -l en -cd .. \ No newline at end of file diff --git a/separate_users/tests/settings.py b/separate_users/tests/settings.py index e22e8f2..5df7bc3 100644 --- a/separate_users/tests/settings.py +++ b/separate_users/tests/settings.py @@ -93,6 +93,8 @@ 'django.middleware.locale.LocaleMiddleware', ) +MIDDLEWARE = MIDDLEWARE_CLASSES + INSTALLED_APPS = EXTERNAL_APPS + INTERNAL_APPS COVERAGE_MODULE_EXCLUDES += EXTERNAL_APPS diff --git a/separate_users/tests/test_app/migrations/0001_initial.py b/separate_users/tests/test_app/migrations/0001_initial.py index 13c409c..cfa40db 100644 --- a/separate_users/tests/test_app/migrations/0001_initial.py +++ b/separate_users/tests/test_app/migrations/0001_initial.py @@ -21,7 +21,7 @@ class Migration(migrations.Migration): }, bases=('auth.user',), managers=[ - (b'objects', separate_users.models.EditorManager()), + ('objects', separate_users.models.EditorManager()), ], ), migrations.CreateModel( @@ -33,7 +33,7 @@ class Migration(migrations.Migration): }, bases=('auth.user',), managers=[ - (b'objects', separate_users.models.FrontendUserManager()), + ('objects', separate_users.models.FrontendUserManager()), ], ), ] diff --git a/separate_users/tests/test_permissions.py b/separate_users/tests/test_permissions.py index 5930b15..8499ed4 100644 --- a/separate_users/tests/test_permissions.py +++ b/separate_users/tests/test_permissions.py @@ -1,10 +1,17 @@ # -*- coding: utf-8 -*- from django.contrib.auth.models import Permission -from django.core.urlresolvers import reverse -from django.test import Client +# from django.test import Client from django.test import TestCase +# compat +import django +if django.VERSION[:2] < (1, 10): + from django.core.urlresolvers import reverse +else: + from django.urls import reverse + + class PermissionsTestCase(TestCase): """ check if permissions are there, after management command was run. diff --git a/separate_users/tests/urls.py b/separate_users/tests/urls.py index 1a1c868..496441a 100644 --- a/separate_users/tests/urls.py +++ b/separate_users/tests/urls.py @@ -1,8 +1,8 @@ """URLs to run the tests.""" -from django.conf.urls import include, url +from django.conf.urls import url from django.contrib import admin urlpatterns = [ - url(r'^admin/', include(admin.site.urls)), + url(r'^admin/', admin.site.urls), ] diff --git a/setup.py b/setup.py index 17b76dc..386d682 100755 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ def read(fname): packages=find_packages(), install_requires=( # 'Django>=1.3,<1.5', # no need to limit while in development - 'Django>=1.8', + 'Django>=1.11', ), include_package_data=True, zip_safe=False, diff --git a/tox.ini b/tox.ini index e9a6595..df48d21 100644 --- a/tox.ini +++ b/tox.ini @@ -1,35 +1,21 @@ - [tox] -envlist = django18, django19, django110, django111 +envlist = py{27,36}-django{111,20} [testenv] commands = python manage.py test setenv = DJANGO_SETTINGS_MODULE=separate_users.tests.settings PYTHONPATH={toxinidir} - -[base] deps = + django111: Django>=1.11,<2.0 + django20: Django>=2.0,<2.1 coverage django-coverage - flake8 - -[testenv:django18] -deps = - {[base]deps} - django>=1.8, <1.9 -[testenv:django19] +[testenv:py27-django20] +whitelist_externals = echo deps = - {[base]deps} - django>=1.9, <1.10 +commands= echo "no django 2.0 on python 2.7!" -[testenv:django110] -deps = - {[base]deps} - django>=1.10, <1.11 - -[testenv:django111] -deps = - {[base]deps} - django>=1.11, <1.12 +[testenv:flake8] +commands = flake8 diff --git a/compilemessages.sh b/translations.sh similarity index 53% rename from compilemessages.sh rename to translations.sh index f519a5c..c5dea9f 100755 --- a/compilemessages.sh +++ b/translations.sh @@ -1,4 +1,6 @@ + cd separate_users +django-admin.py makemessages -l en -l de -l fr django-admin.py compilemessages cd .. \ No newline at end of file