Code Monkey home page Code Monkey logo

django-separate-users's Introduction

django-separate-users

Build Status PyPi Version Licence

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)
  • better admin list views (filters, is_active, etc)

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

In your settings, add to INSTALLED_APPS

INSTALLED_APPS = [
    ...
    'separate_users',
    ...
]

Also, you NEED to define a MIGRATION_MODULES entry for separate_users (yes, a migration is created for proxy models!). As your UserModel might be different, we cannot guess the needed migrations, so you'll need to create them yourself.

MIGRATION_MODULES = {
    'separate_users': 'your_apps.separate_users_migrations',
}

You'll need to create this folder, with an __init__.py in it, then you can run ./manage.py makemigrations (try --dry-run to see if it works as you would expect).

As of a django bug, you'll want to run ./manage.py fix_proxy_permissions, otherwise your non superusers (but staff) might not be able to edit frontend and/or editor users.

django-separate-users's People

Contributors

benzkji avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.