Skip to content

Commit

Permalink
Merge branch 'master' of github.com:benzkji/django-separate-users
Browse files Browse the repository at this point in the history
  • Loading branch information
benzkji committed May 25, 2018
2 parents acd04c9 + 68ad26f commit 4ccaae3
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 37 deletions.
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
9 changes: 8 additions & 1 deletion PYPI.rst
Original file line number Diff line number Diff line change
@@ -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
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
# 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.

- 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

Expand Down
5 changes: 0 additions & 5 deletions makemessages.sh

This file was deleted.

2 changes: 2 additions & 0 deletions separate_users/tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
'django.middleware.locale.LocaleMiddleware',
)

MIDDLEWARE = MIDDLEWARE_CLASSES

INSTALLED_APPS = EXTERNAL_APPS + INTERNAL_APPS
COVERAGE_MODULE_EXCLUDES += EXTERNAL_APPS

Expand Down
4 changes: 2 additions & 2 deletions separate_users/tests/test_app/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -33,7 +33,7 @@ class Migration(migrations.Migration):
},
bases=('auth.user',),
managers=[
(b'objects', separate_users.models.FrontendUserManager()),
('objects', separate_users.models.FrontendUserManager()),
],
),
]
11 changes: 9 additions & 2 deletions separate_users/tests/test_permissions.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions separate_users/tests/urls.py
Original file line number Diff line number Diff line change
@@ -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),
]
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
30 changes: 8 additions & 22 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions compilemessages.sh → translations.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@


cd separate_users
django-admin.py makemessages -l en -l de -l fr
django-admin.py compilemessages
cd ..

0 comments on commit 4ccaae3

Please sign in to comment.