Skip to main content

A simple app to manage newsroom staff and hierarchy.

Project description

django-editorial-staff

django-editorial-staff is a simple Django app to store and manage editorial staffers, and the organizational hierarchy they work in.

It includes a robust API that other apps can treat as a "single source of truth" for users in the organization.

It also includes a "data provider" feature that will quickly and automatically ingest users' data from third-party services (and ships with a "data provider" for Slack organizations).

Quick start

  1. Install this app:

     pip install django-editorial-staff
    
  2. Add four entries (three helper apps and "editorial_staff") to your INSTALLED_APPS setting (in settings.py) like this:

    INSTALLED_APPS = [
        ...
        'bootstrap3',
        'colorfield',
        'rest_framework',
        ...
        'editorial_staff',
    ]
    
  3. Add the following lines to your settings.py file (to configure form rendering):

     BOOTSTRAP3 = {
         'field_renderers': {
             'default': 'bootstrap3.renderers.FieldRenderer',
             'inline': 'bootstrap3.renderers.InlineFieldRenderer',
             'immaterial': 'editorial_staff.field_renderers.ImmaterialFieldRenderer',
         },
     }
    
  4. Include the editorial_staff URLconf in your project urls.py like this:

    url(r'^staff/', include('editorial_staff.urls')),
    
  5. Run python manage.py migrate to create the staff models.

  6. Start the development server and visit http://127.0.0.1:8000/staff/ to see a list of staffers and add others.

  7. Visit http://127.0.0.1:8000/staff/api/ to explore the app's REST API.

Configuration

Several included settings allow you to customize most aspects of django-editorial-staff.

Settings related to the "data provider" feature are discussed in the following section. The other available settings are:

Setting name Default value Description
EDITORIAL_STAFF_BASE_URL '' (empty str) Optional. The full URL of the server on which this app/project will live. Used to generate links sent via Slack.
EDITORIAL_STAFF_LOGOUT_URL None Optional. Named URL pattern of a view that logs users out. If blank, there won't be a log-out link included in the app-wide navigation.
EDITORIAL_STAFF_EMAIL_DOMAIN 'example.com' Optional. The domain name at which most of your staffers receive email. Used mainly to generate the user@example.com placeholder text on the staffer-creation form.
EDITORIAL_STAFF_API_NAME 'Staff API' Optional. The branded name for the API generated by this app. Only shown on Django REST framework-generated pages. This is not very important; it's just included here as it's easy to pass this option down to REST framework.

Data provider configuration

django-editorial-staff's data providers are configured in two parts:

  • With the EDITORIAL_STAFF_DATA_PROVIDER setting, a string that can containe the path to the provider being used (or None to use the app without a data provider), and

  • With the EDITORIAL_STAFF_DATA_PROVIDER_OPTIONS setting, a dictionary of additional options for the chosen provider.

The second of these settings is intended to be flexible, with its dictionary containing attributes that are fairly unique to the active provider.

Currently the app only includes one provider ('editorial_staff.data_providers.SlackProvider'), which enables users to retrieve staffer data from a connected Slack workspace. This provider has two possible values that can be defined in EDITORIAL_STAFF_DATA_PROVIDER_OPTIONS:

  • notification_channel, the name of the Slack channel where "new staffer created" announcements are posted, and
  • excluded_email_domains, which prevents Slack user data from being imported into new staffer objects if a Slack user's email address domain is in this list.

NOTE: If EDITORIAL_STAFF_DATA_PROVIDER is set to None (or omitted from the settings.py file entirely), no provider will be connected.

Integrating with Slack

To start using the Slack data provider, follow the installation steps above, then do the following.

  1. Install the following Slack-provider-specific dependencies:

    pip install probablepeople~=0.5.4
    pip install slacker~=0.9.0
    
  2. Add the data-provider settings mentioned above to your settings.py file:

    ...
    EDITORIAL_STAFF_DATA_PROVIDER = 'editorial_staff.data_providers.SlackProvider'
    
    EDITORIAL_STAFF_DATA_PROVIDER_OPTIONS = {
        'notification_channel': 'staffer-announcements',  # Can also be omitted
    }
    ...
    

    (where staffer-announcements is the name of the channel you want to receive messages whenever a staffer is added).

  3. Create an API token in your Slack workspace and add it to your settings.py file under the SLACK_TOKEN name.

Front-end development

django-editorial-staff front-end pages are built using ES6 and SCSS, and this app includes a Gulp installation that converts files written in these dialects to plain JavaScript and CSS, respectively.

When developing on the front-end, you'll need to run this Gulp installation yourself. Follow these steps to get started.

  1. Open a terminal window and navigate to the root of this app.

  2. Within the app, navigate to ./editorial_staff/staticapp.

  3. If this is your first time running Gulp on this project, run npm install to install JS dependencies. This may take several minutes.

  4. Once your dependencies are installed, run gulp to begin local development.

  5. When your Gulp server says it's up and running, visit http://127.0.0.1:3000/staff/ for a live preview of your front-end files.

  6. Proceed to modify your front-end interface by changing files in ./editorial_staff/staticapp/scss/ and ./editorial_staff/staticapp/js/. Your changes will be applied to the Gulp server URL without the need for to reload the page manually.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-editorial-staff-0.8.0.tar.gz (2.8 MB view details)

Uploaded Source

Built Distribution

django_editorial_staff-0.8.0-py2.py3-none-any.whl (2.9 MB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-editorial-staff-0.8.0.tar.gz.

File metadata

  • Download URL: django-editorial-staff-0.8.0.tar.gz
  • Upload date:
  • Size: 2.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5

File hashes

Hashes for django-editorial-staff-0.8.0.tar.gz
Algorithm Hash digest
SHA256 f33d769e515f6794ea97489484f60c54be91e039eee196b803db8078ea499eab
MD5 349fc432cfae935e004c51587449e7df
BLAKE2b-256 849bcf5db826181de5d87edf21c5e13ee07feda2f881218ce856db0fc1e7a649

See more details on using hashes here.

File details

Details for the file django_editorial_staff-0.8.0-py2.py3-none-any.whl.

File metadata

  • Download URL: django_editorial_staff-0.8.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5

File hashes

Hashes for django_editorial_staff-0.8.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e1df51005312bef32473b33b05d50dd07354940a75fa07c240f10e2911bc2c6c
MD5 6228085bddd1c0877475dc0d8534b6d3
BLAKE2b-256 1cd22c73e18759e60e80efa73e90ed5d006071306c6d097a03523256bc0fdb53

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page