Quickstart

  1. Follow the installation guide:
  1. Install Quade with pip:

    pip install quade
    
  2. Add Quade to your project’s INSTALLED_APPS:

    INSTALLED_APPS = [
        ...
        'quade.apps.QuadeConfig',
    ]
    
  3. Initialize the Quade settings by adding these lines to your Django settings:

    import quade
    
    QUADE = quade.Settings()
    
(By default, Quade will only be available when DEBUG=True. For more details, see Settings.)
  1. Add the django_jinja template handler to your TEMPLATES setting, while retaining any other template handlers you have. For example:

    TEMPLATES = [
        # Existing code, leave in-place
        {
            'BACKEND': 'django.template.backends.django.DjangoTemplates',
            ...
        },
        # New code to add
        {
            'BACKEND': 'django_jinja.backend.Jinja2',
            'DIRS': [],
            'APP_DIRS': True,
            'OPTIONS': {
                'app_dirname': 'jinja2',
            },
        },
    ]
    
  2. Add Quade to your URL configuration, e.g.:

    # urls.py
    
    urlpatterns = [
        ...
        url(r'^quade/', include('quade.urls'))
    ]
    
  3. Run migrations:

    python manage.py migrate quade
    
  1. Create a fixtures file, fixtures.py, in the root of your project:

    # fixtures.py
    
    import uuid
    
    from django.contrib.auth import get_user_model
    
    from quade.managers import register
    
    
    User = get_user_model()
    
    
    @register
    def user():
        new_user = User.objects.create(
            first_name='Alyssa',
            last_name='Hacker',
            username='alyssa-{}'.format(uuid.uuid4())
        )
        return "User #{}".format(new_user.pk)
    
  2. Update your settings to make Quade aware of your fixtures file:

    QUADE = quade.settings(fixtures_file='fixtures')
    
  3. Enter the Django shell and create a Scenario that uses this fixture:

    from quade.models import Scenario
    Scenario.objects.create(
        config=[('user', {})],
        description='Single User',
        slug='single-user',
        status=Scenario.Status.ACTIVE
    )
    
  4. Start your project’s webserver and visit the main Quade page. You will be able to generate new users on demand by selecting the “Single User” scenario and executing it.

  5. Begin creating your own fixtures and Scenarios!