Skip to content

Commit

Permalink
Make plugin installable in production (#3)
Browse files Browse the repository at this point in the history
* Added __init__.py to migrations folder

* fix migration and added MANIFEST.in to also include static and templates

* Added include_package_data=True option

* Move static files into sub-directory

* Updated installation instructions and added MIN_VERSION
  • Loading branch information
wolflu05 authored Dec 20, 2022
1 parent 2c6cf24 commit de57825
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 21 deletions.
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include LICENSE
include README.md
recursive-include inventree_bulk/static *
recursive-include inventree_bulk/templates *
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,15 @@ A bulk creation plugin for [InvenTree](https://inventree.org), which helps you g

## Installation

1. Install this plugin as follows:

```bash
pip install git+https://github.com/wolflu05/inventree-bulk-plugin
```

Or, add to your `plugins.txt` file:

```txt
git+https://github.com/wolflu05/inventree-bulk-plugin
```

2. Goto your plugin settings and ensure that you allow the use of the url integration and app integration
Install this plugin as follows:

1. Make sure you allow the use of the url integration and app integration (see [Why does this plugin needs the app mixin?](#why-does-this-plugin-needs-the-app-mixin))

2. Goto Settings > Plugins > Install Plugin, set `inventree-bulk-plugin` as package name and `git+https://github.com/wolflu05/inventree-bulk-plugin` as source URL. Enable the confirm switch and click submit.

3. Restart your server and activate the plugin.

4. Stop your server and run `invoke update` (for docker installs it is `docker-compose inventree-server invoke update`). This ensures that all migrations run and the static files get collected. You can now start your server again and start using the plugin.

## Usage

Expand Down Expand Up @@ -73,7 +69,7 @@ Dimensions are a way to add various counting strategies to your naming. You can

A `dimension` can be either specify a range or a generic name. You can use the count field to limit a generic dimension to a specific amount of generating items.

Ranges: `A-G`,`f-x`, `1-3`, `A-XZ`
Ranges: `A-G`,`f-x`, `1-3`, `A-XZ` <br/>
Generics: `NUMERIC` (0-9), `ALPHA_LOWER` (a-...), `ALPHA_UPPER` (A-...).

##### Generate
Expand Down
1 change: 1 addition & 0 deletions inventree_bulk/BulkActionPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class BulkActionPlugin(AppMixin, PanelMixin, UrlsMixin, InvenTreePlugin):
AUTHOR = "wolflu05"
DESCRIPTION = "Bulk action plugin"
VERSION = BULK_PLUGIN_VERSION
MIN_VERSION = "0.9.1" # due to "invoke update" doesn't run collectstatic (see #inventree/InvenTree#4077)

TITLE = "Bulk Action"
SLUG = "bulkaction"
Expand Down
Empty file.
3 changes: 2 additions & 1 deletion inventree_bulk/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by Django 3.2.16 on 2022-12-16 13:27

from django.db import migrations, models
from ..models import validate_template


class Migration(migrations.Migration):
Expand All @@ -17,7 +18,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=250)),
('template_type', models.CharField(max_length=100)),
('template', models.TextField()),
('template', models.TextField(validators=[validate_template])),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load static %}
<script src="{% static 'preact.js' %}"></script>
<script src="{% static 'htm.js' %}"></script>
<script src="{% static 'inventree-bulk/preact.js' %}"></script>
<script src="{% static 'inventree-bulk/htm.js' %}"></script>

<div id="bulk-create-category-preact-root"></div>

Expand Down
4 changes: 2 additions & 2 deletions inventree_bulk/templates/panels/stock-index/manage-bulk.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load static %}
<script src="{% static 'preact.js' %}"></script>
<script src="{% static 'htm.js' %}"></script>
<script src="{% static 'inventree-bulk/preact.js' %}"></script>
<script src="{% static 'inventree-bulk/htm.js' %}"></script>

<div id="bulk-create-manage-preact-root"></div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load static %}
<script src="{% static 'preact.js' %}"></script>
<script src="{% static 'htm.js' %}"></script>
<script src="{% static 'inventree-bulk/preact.js' %}"></script>
<script src="{% static 'inventree-bulk/htm.js' %}"></script>

<div id="bulk-create-location-preact-root"></div>

Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,6 @@
"BulkActionPlugin = inventree_bulk.BulkActionPlugin:BulkActionPlugin"
]
},

include_package_data=True,
)

0 comments on commit de57825

Please sign in to comment.