Skip to main content

A simple Django app to manage a bill of materials.

Project description

BOM

BOM is a simple Django app to manage a bill of materials. It is a level up from an excel spreadsheet including an indented bill of materials, Octopart price match, Google Drive integration, and more. It is written in Python 3.7 and Django 2.

BOM can be added to an existing (or new) Django project, or stand alone on its own, which can be more convenient if you're interested in tweaking the tool.

An example of the app in use can be seen here.

If you already have a django project, you can skip to Add Django Bom To Your App, otherwise Start From Scratch: Add to new Django project to add it to a new django project, or Start From Scratch: Use as standalone Django project.

Table of contents

Start From Scratch: Add to a new Django project

  1. To start from scratch we recommend setting up a virtual environment
virtualenv -p python3 mysite
cd mysite
source bin/activate
  1. From here install django, and set up your project.
pip install django
django-admin startproject mysite
cd mysite
python manage.py migrate
python manage.py createsuperuser # make a user for your development environment
  1. Continue on to Add Django Bom To Your App.

Add Django Bom To Your App

django-bom is a reusable django application. If you don't already have a django project, you can follow some quick steps below to get up and running, or read about creating your first django app here. Note that django-bom currently supports python 2.7.

pip install django-bom
  1. Add "bom" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [
    ...
    'bom',
    'social_django', # to enable google drive sync in bom
    'materializecssform',
]
  1. Update your URLconf in your project urls.py like this::
path('bom/', include('bom.urls')),

And don't forget to import include:

from django.conf.urls import include
  1. Update your settings.py to add the bom context processor 'bom.context_processors.bom_config', to your TEMPLATES variable, and create a new empty dictionary BOM_CONFIG.
TEMPLATES = [
    {
        ...
        'OPTIONS': {
            'context_processors': [
                ...
                'bom.context_processors.bom_config',
            ],
        },
    },
]

and

BOM_CONFIG = {}
  1. Run python manage.py migrate to create the bom models.

  2. Start the development server python manage.py runserver and visit http://127.0.0.1:8000/admin/ to manage the bom (you'll need the Admin app enabled).

  3. Visit http://127.0.0.1:8000/bom/ to begin.

Start From Scratch: Use as a standalone Django project

  1. To start from scratch we recommend setting up a virtual environment
virtualenv -p python3 mysite
cd mysite
source bin/activate
  1. From here install django, and set up your project.
git clone https://github.com/mpkasp/django-bom.git
pip install -r requirements.txt
python manage.py migrate
python manage.py runserver

Customize Base Template

The base template can be customized to your pleasing. Just add the following configuration to your settings.py:

BOM_CONFIG = {
    'base_template': 'base.html',
}

where base.html is your base template.

Mouser Integration

For part matching, make sure to add your Mouser api key. You can get your key here.

Google Drive Integration

Make sure to add the following to your settings.py:

AUTHENTICATION_BACKENDS = (
    'social_core.backends.google.GoogleOpenId',
    'social_core.backends.google.GoogleOAuth2',
    'social_core.backends.google.GoogleOAuth',
    'django.contrib.auth.backends.ModelBackend',
)

SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE = ['email', 'profile', 'https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/plus.login']
SOCIAL_AUTH_GOOGLE_OAUTH2_AUTH_EXTRA_ARGUMENTS = {
    'access_type': 'offline',
    'approval_prompt': 'auto'
}

And if you're using https on production add:

SOCIAL_AUTH_REDIRECT_IS_HTTPS = not DEBUG

Contributing

Contributions welcome! Before contributing your work please read the contributing readme.

Also reach out to mike@indabom.com to discuss features, and join our slack channel.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

django-bom-1.113.tar.gz (335.9 kB view details)

Uploaded Source

File details

Details for the file django-bom-1.113.tar.gz.

File metadata

  • Download URL: django-bom-1.113.tar.gz
  • Upload date:
  • Size: 335.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.7.4

File hashes

Hashes for django-bom-1.113.tar.gz
Algorithm Hash digest
SHA256 c4936a9238f01aa9c9978e32113ea1bb9473dfb00a54874be0f9081e8e13d7b0
MD5 10a25fa4b4fed9ed19c6b1ce1bc50136
BLAKE2b-256 b04aa05431671efe4787e6f420647c33beac8b8188716670eb8614f0a4a81233

See more details on using hashes here.

Supported by

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