Skip to content

Provides the data models for the startup accelerator system initiated by MassChallenge.

License

Notifications You must be signed in to change notification settings

masschallenge/django-accelerator

Repository files navigation

Django-Accelerator

License: MIT Build Status Test Coverage Maintainability

THIS REPOSITORY IS NOW DEPRECATED

The code has been ported into the accelerate project; this repository is no longer in use or receiving updates, and will be decomissioned presently.

  1. Overview
  2. Quickstart
    1. As a dependency for MassChallenge's Accelerate/Impact-API
    2. As a dependency for a stand-alone django project
  3. Development
    1. Changing A Swappable Model
    2. Generating Migrations
    3. Running Migrations
    4. Testing

Accelerator is a simple Django package which provides models for the MassChallenge Accelerator applications.

Overview

The package supports two modes of use, in two different Django apps:

  • accelerator_abstract - abstract models, declaring all the fields and relationships between the Base-models. All the models were made to be swappable,using Django-swappable-models.
  • accelerator - regular concrete django models, ready for use. Those models are the default concrete implementation of the abstract models defined in accelerator_abstract.

The package also includes a third django app, simpleuser, that slightly extends the default django user model. It is also swappable, in the usual way.

Quickstart

As a dependency for MassChallenge's Accelerate/Impact-API

The development environment for Accelerate and Impact-API were configured to use django-accelerator as an editable source.

Follow the instructions on Setting Up The Development Environment for further details.

As a dependency for a stand-alone django project

  1. Add "accelerator" to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'accelerator.apps.AcceleratorConfig',
    ]
    

2. Run python manage.py migrate

3. The installed models should now appear in your application's admin and through the Django shell.

Development

Changing A Swappable Model

Since Django-accelerator uses Swappable Models. changing the Django models is slightly different than usual.

The key differences to note are:

  • All the model declarations - Django fields, methods, meta configration, etc. - should live in the respective Base model, inside accelerator_abstract.models. This makes the changes usable both by the accelerator app, and any app that inherits directly from accelerator_abstract and declares its own concrete models.

  • The Concrete model in accelerator should have no other role but:

    • to be a concrete subclass of a base model.
    • to declare the Meta.swappable configuration.

    E.g. the Startup model looks like this:

    <