Commit Graph

42 Commits

Author SHA1 Message Date
Oliver
a613a7b9fc
Use whitenoise for static file handling (#6662)
* Update config_template.yaml file

* Adjust ALLOWED_HOSTS behaviour

- Only add wildcard * in DEBUG mode
- Exit if ALLOWED_HOSTS not defined

* Tweak error message

* Use whitenoise for serving static files

- Any requests to /static/ are handled by whitenoise
- If an external reverse proxy (e.g. Caddy) is being used, this will not make a difference

* Update python package requirements

* Add extra log output

* Update ENV for CI checks

* Updates

- Thow error but do not exit
- Revert CI changes
2024-03-08 11:11:30 +11:00
Oliver
950bda4ef6
Fix grpcio version (#6635)
- Pinned in https://github.com/inventree/InvenTree/pull/6621 (for testing)
- Accidentally left in uploaded code
2024-03-04 12:17:09 +00:00
Oliver
cbc879f618
[Docker] Fix broken image (#6621)
* Install grpcio faster

- Pin version
- Update build packages

* Test dockerfile before push

- SImply test if invoke is present

* Revert commit to docker-compose

* Remove VIRTUAL_ENV from Dockerfile

* Fix pip install

* Run extra checks on docker image

* Ensure mariadb links are installed:

- Closes https://github.com/inventree/InvenTree/issues/6625

* Adjust CI

 build docker image manually

* Should fail

- Test that revert fails CI

* Ok, this should break it

* Fix Dockerfile
2024-03-04 22:50:00 +11:00
Oliver
f6123cc261
[WIP] docker / Caddy (#6551)
* remove docker-sqlite file

- Do not want to encourage use of sqlite

* Add Caddyfile

* Add default site URL to .env

- Matches Caddyfile

* Cleanup / simplify .env file

* Remove dev nginx conf file

* Further cleanup of .env file

* Update docker-compose.yml

- Use caddy image instead of nginx as proxy

* Set max body size

* gunicorn: enable external logging

* Update file structure

* Cleanup docker-compose file

* Update docker/docker-compose.yml

Co-authored-by: Matthias Mair <code@mjmair.com>

* Update docker/Caddyfile

Co-authored-by: Matthias Mair <code@mjmair.com>

* Fix for postgresql packages

- Need postgresql13-client to be installed, it contains pg_dump
- Without this, backup / restore *does not work*

* Create static_i18n dir if it does not exist

* Reduce output from collectstatic

* Revert gunicorn logging

- Want to see the logs in docker

* Fix trailing slash

Ref: https://github.com/inventree/InvenTree/pull/6551#issuecomment-1962423765

* tasks.py - pass 'nouv' option through

* Update package requirements:

- Allow installation of rapidfuzz without building

* Install uv as part of docker image

* Add environment variable to control downstream URL

* Do not use uv package manager by default

- Currently does not work "correctly" - ignores installed packages
- Requires further work to run reliably

* Fix docker-compose file

- Do not build locally

* Cleanup gunicorn file

- Remove unused lien

* Cleanup docker-compose.yml

- Simpler volume management

* Update Caddyfile

Add newline

* Update requirements.txt

Add newline

* Update tasks.py

Add missing blank line

* Simplify Caddyfile

* Adds option for customizing web port

* cleanup docker-compose.yml

- Better mapping of caddy data
- Cleaner volume setup

* Add django version template

- Ensure all docs links point to the current django version we are using

* docs: cleanup intro.md

* Cleanup serving_files.md

* Cleanup config.md

* docker install docs updates

* Enable code block copying

* Fix include file

* Fix link

* Update docker install docs

* Update docker.md

* Add info about demo dataset

* Tweak heading

* Update docs link checks

* Fix workflow

* Another fix

* More ignore pattearns

---------

Co-authored-by: Matthias Mair <code@mjmair.com>
2024-02-28 01:06:19 +11:00
Matthias Mair
d36cf358f8
Bump to Dj 4.x (#6173)
* bump to dj >4.2

* switch to experimental git release

* bump django-import_export

* bump mptt

* replace is_ajax, which was removed
https://docs.djangoproject.com/en/3.1/releases/3.1/#id2

* Save before accessing values in m2m/fk fields

* move plugin init

* use dev version of django for fix

* update deps

* fix deps

* use django smaller 4.2

* fix reqs

* fix merge

* remove moved code

* another merge fix

* fix ajax call

* fix refs

* change python min v

* fix deps

* bump deps

* fix deps

* pin pillow

* dj 4.1 upgrades

* make diff smaller

* bump all deps

* drop down to py3.9

* bump versions

* merge fix

* fix diff

* more bumping

* diff cleanup

* bump deps

* fix reqs

* use accurate state for model migrations
using apps the historically correct state is used

* try import

* added more logs

* add try here too

* clean up rebuilds

* Dj 4.2 (#161)

* autochanges

* bump

* fix diff

* fix diff

* bump deps

* fix req

* remove select_related to test error influence

* switch to mptt fork

* fix reqs for upstream

* move tracking ensureance into save

* optimize check frequency

* use psycopg instead of psycopg2

* fix header

* just use the values

* switch to dj < 4.2

* fix req

* another req fix

* switch to 4.2 again

* fix merge error

* Check for null pk in calculate_total_price

Cannot access self.lines if pk is Null

* use patched mptt

* try psycopg2 again

* Remove tree rebuild from migrations

* Prevent notify_users if importing or migrating

* Add order_by() to subquery annotations

- Ref: https://stackoverflow.com/a/629691

* Update stock filters

- Append order_by()

* fix error if running without timezones in testing

* add logging to figure this out

* remove tz from self.creation if TZ is off

* add tz?

* move around?

* only run the test i am trying to figure out
not reproducible on my machine

* only run the test i am trying to figure out
not reproducible on my machine

* run all tests again

---------

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
2024-02-06 13:30:50 +11:00
Matthias Mair
64dbf8c1e3
[FR] Add tracing support (#6211)
* [FR] Add tracing support
Fixes #6208

* move checks out of manage.py

* fixed reqs

* small cleanup

* move tracing init to settings
similar to how sentry is handled

* rephrase

* clean up imports

* added argument regarding console debugging

* fix typing

* added auth section

* remove empty headers

* made protocol configurable

* rename vars & cleanup template

* more docs for template

* add docs
2024-01-18 17:50:05 +11:00
Oliver
a63529a9cf
Update django-allauth version (#6099)
* Patch for django-allauth 0.55.0

- Some breaking changes here
- Add logger error if auth provider cannot be imported
- Fix for API endpoints

* Only provide URLs for configured plugins

* Update for django-allauth 0.56.0

- Remove support for keycloak
- Remove example from configuration template

* Update django-allauth in requirements.txt

* Update requirements.in

* Refactor SSO functions into common file

* Update config template file

* Update docs

* Fix template files

* Log SSO exceptions to the database

- WIll help greatly with debugging installs

* Add note about error handling in docs
2023-12-18 17:35:36 +11:00
Matthias Mair
d30ff8a291
Bump weasyprint (#5885)
* bumped weasyprint

* factored reused section out (reduce DB access)

* added pdf-context testing

Co-authored-by: miggland <miggland@users.noreply.github.com>

* switched to pdfminer.six

* make test more resilient

---------

Co-authored-by: miggland <miggland@users.noreply.github.com>
2023-11-20 09:35:11 +11:00
dependabot[bot]
26b2e90fcf
Bump pillow from 9.5.0 to 10.0.1 (#5657)
* Bump pillow from 9.5.0 to 10.0.1

Bumps [pillow](https://github.com/python-pillow/Pillow) from 9.5.0 to 10.0.1.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/9.5.0...10.0.1)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Patch requirements files

* Update package requirements

* Improve offload_task function:

- Return True if the task runs or was offloaded
- Improved warning information

* Improve unit tests for task offloading

- Check return value of offload_task
- Check log output

* Bump django-stdimage

* Fix tasks.py

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
2023-11-07 10:08:03 +11:00
Bobbe
59f17a9885
Bump django_money version back to 3.2.0, Fix #5825 (#5828)
* Bump django_money version back to 3.2.0

* Test building docker image

* Revert "Test building docker image"

This reverts commit b8e9d4f4c1.
2023-11-01 10:05:47 +11:00
Bobbe
4913acda79
Update django money / py-moneyed dependencies (#5778)
* Replace moneyed format_money function

* Update django-money to 3.3.0 and py-moneyed to 3.0

* Add CurrencyField migrations

* Fix checking if decimal_places is set

* Add currency formatting test

* Test fixing deepsource test patterns

* Revert "Test fixing deepsource test patterns"

This reverts commit 398ef93cd6.

* FIx requirements.txt formatting

* Revert "FIx requirements.txt formatting"

This reverts commit bb554b0758.
2023-10-31 22:19:55 +11:00
Matthias Mair
158a209a0f
Version bump (#5740)
* Updated all dependencies

* fixed some spelling errors

* More spelling corrections

* Fixes for changes in react-query
2023-10-18 07:27:28 +11:00
Oliver
e9e505edd4
Import export fix (#5677)
* Update django-import-export

* Add custom handler to ensure data import is not too excessive
2023-10-09 11:48:17 +11:00
Matthias Mair
683cf248ea
Bump deps (#5487)
* bump deps

* bump again

* bump frontend as well

* fixed allauth version for now

* fixed requirements files

* fixed requirements files 2

* fixed changed lib path
2023-09-07 09:02:31 +10:00
Matthias Mair
71026c338c
Use error report fork (#5171)
* switch to django-error-report-2

* fix commit

* bump version

* bump error-report version
2023-08-06 21:41:57 +10:00
Oliver
b717011f06
Docker build: Update python deps (#5270)
* Update python deps

* Update requirements.in

* Fix requirements-dev.txt
2023-07-18 19:43:45 +10:00
Matthias Mair
a9a8ac1c70
Add email login (#5209)
* Add email login
FR] Add email link based logins Closes #3531

* fix reqs

* fix backend code

* Add tests for magic login
2023-07-11 08:13:35 +10:00
Oliver
c91fbdbc48
use django-q2 (#5167)
* use django-q2

- Modern fork of django-q

* Update requirements.txt
2023-07-05 22:53:32 +10:00
Matthias Mair
aec56d4b34
Bump general deps (#5170)
* bump deps

* down to py 3.9

* pin pillow
2023-07-05 07:20:56 +10:00
Matthias Mair
b700b44c53
Add dj-rest-auth (#4187)
* Add dj-rest-auth
[FR] User registration via API
Fixes #3978

* add jwt support for API

* check for old password

* Add check if registration is allowed

* make email mandatory if selected

* lower postgres version?

* update req

* revert psql change

* move form options out

* Update reqs

* Add handlers for most OAuth2

* refactor and add logging

* make error message more actionable

* add handler for twitter

* add keycloak endpoint

* warning for legacy apps

* remove legacy twitter support

* rename file

* move url to sub

* make JWT optional (default off)

* Add var to config template

* Add API endpoint to list available providers

* fix url pattern
2023-06-20 16:26:02 +10:00
Matthias Mair
9f56ee1023
[FR] Add Feature flags (#4982)
* make currency choices independend

* Remove check for field, just try to get rid of it

* Add IF EXISTS to avoid error (works in postgres)

* Look for operational error, not programming error

* Use variants, depending on errors caused

* [FR] Add Feature flags
Fixes #4965

* Add option to define custom flags

* Revert "make currency choices independend"

This reverts commit ab84a7ff83.

* try fixing mysql

* more safeguards

* fix executioner call

* a fck

* use migrations. syntax

* and another round for mysql

* revert print change

* use UTC for datetime

* Update part.migrations.0112

- Add custom migration class which handles errors

* Add unit test for migration

- Ensure that the new fields are added to the model

* Update reference to PR

* fix ruleset for missing_models

* fix ruleset for flags_flagstate

* add API endpoints for flags

* add tests for new API endpoints

* fix tests

* fix merge

* fix tests

---------

Co-authored-by: martin <martin@iggland.com>
Co-authored-by: Oliver Walters <oliver.henry.walters@gmail.com>
2023-06-12 13:13:53 +10:00
Matthias Mair
15ab911da6
Add more version information (#5014)
* Add info for installer, branch, publisher

* include version info

* fix permissions

* fix typo

* add more info

* use GH url

* fix node

* remove publisher

* remove more logging

* Add info to version view

* enable branch discovery when not set

* fix ref to github version

* add branch to about dialog

* use precise plattform information - if no env is set

* fix ref names

* load VERSION info

* rename plattform to target

* extend installer var

* add generic plattform info

* add docs for version info

* add more info

* add installer codes

* Ammend navigation
2023-06-12 00:32:03 +10:00
Matthias Mair
58a33c2e67
[FR] Switch from git to dulwich (#4966)
* [FR] Switch from pure git to dulwich Fixes #4942

* fix lenght

* change length again

* change length again
2023-06-05 19:27:46 +10:00
Matthias Mair
a196f443a1
Bump deps (#4911)
* bump deps

* Update requirements.txt

* fix pint

* fix reqs

* fix dev reqs
2023-05-31 09:18:02 +10:00
Oliver
9e77b9fc56
Parameter filtering (#4823)
* adds new field 'parameter type' to PartParameterTemplate model

* Move part parameter settings onto their own page

* Add "choices" and "regex" template types

* Adds validation for PartParameter based on template type

* javascript cleanup

* Fix for serializers.py

* Add unit testing for parameter validation

* Add filters

* Rename "type" field to "param_type"

- Should have seen that one coming

* Coerce 'boolean' value to True/False

* table update

* js linting

* Add requirement for "pint" package

* Add validator for physical unit types

- Revert a previous migration which adds "parameter type" and "validator" fields
- These will get implemented later, too much scope creep for this PR
- Add unit test for validation of "units" field

* Update PartParameter model

- Add data_numeric field (will be used later)
- Add MinLengthValidator to data field

* Run validation for part parameter data

- Ensure it can be converted to internal units

* Update admin interface to display partparameter values inline for a part

* Adds validation of part parameter data value

- Also converts to base units, and stores as "numeric" value
- Display "numeric" value in tables
- Create new file conversion.py for data conversion

* Update unit tests and fix some bugs

* Update docstring

* Add units to parameter columns in parameteric part table

* Allow part list to be ordered by a particular parameter value

- Annotate queryset with new "order_by_parameter" method
- Skeleton method for future work

* Bump API version

* Adds unit testing for sorting parts by parameter value

* Update historical data migrations

- Turns out RunPython.noop is a thing?

* Cache the unit registry

- Creating the unit registry takes a significant amount of time
- Construct when first called, and then cache for subsequent hits
- Massive improvement in performance

* Throw error on empty values when converting between units

* Data migration for converting existing part parameter values

* Handle more error cases

* Show parameteric table on top-level part page too

* Unit test for data migration

* Update credits in docs

* Improved error checking

* WIP docs updates

* Fix parameteric table filtering

* remove zoom property

* Fix for import path

* Update parameter docs

* Run background task to rebuild parameters when template changes

* Make "data_numeric" field nullable

- Defaulting to zero is not appropriate, as the actual value may be zero
- Sorting still seems to work just fine

* Fixes for unit test

* More unit test fixes

* Further fixes for unit tests

---------

Co-authored-by: Matthias Mair <code@mjmair.com>
2023-05-19 13:24:55 +10:00
Oliver
e2505433a2
Docker build fix (#4811)
* Attempt to fix crypto build on raspbian

* Run CI if requirements files change
2023-05-15 08:27:26 +10:00
Matthias Mair
f5c2591fd4
Add 'Tag' management (#4367)
* 'Tag' management
Fixes #83

* Add for ManufacturerPart, SupplierPart

* Add tags for StockLocation, StockItem

* fix serializer definition

* add migrations

* update pre-commit

* bump dependencies

* revert updates

* set version for bugbear

* remove bugbear

* readd bugbear remove isort

* and remove bugbear again

* remove bugbear

* make tag fields not required

* add ruleset

* Merge migrations

* fix migrations

* add unittest for detail

* test tag add

* order api

* reduce database access

* add tag modification test

* use overriden serializer to ensuer the manager is always available

* fix typo

* fix serializer

* increae query thershold by 1

* move tag serializer

* fix migrations

* content_types are changing between tests - removing them

* remove unneeded fixture

* Add basic docs

* bump API version

* add api access to the docs

* add python code

* Add tags to search and filters for all models
2023-05-04 09:02:48 +10:00
Matthias Mair
9d5522c18c
[FR] Update to OpenAPI from CoreAPI (#4178)
* [FR] Update to OpenAPI from CoreAPI
Fixes #3226

* factor request function out

* add schema export task

* add api-docs

* add action to check if diff occured

* also wait for docstyle

* use full command

* add envs for inventree

* update inventree before running

* use relative path

* remove schema action

* remove tags to fit 3.0 parsers

* fix url base name for reloads

* revert change in plugin resolver

* remove unused tags

* add rapidoc too

* declare api regex

* fix as suggested by @martonmiklos in
https://github.com/inventree/InvenTree/pull/4178#discussion_r1167279443

* set inventree logo

* remove Rapidoc
2023-04-18 23:08:36 +10:00
Oliver
eef303dfea
Cryptography version update (#4568)
* Update required cryptography library version

* remove old env variable from dockerfile

- Was required when we based on alpine linux
- now we use python_slim

* Fix file contents
2023-04-04 07:04:10 +10:00
Matthias Mair
32be1b2035
Update dependencies (#4368)
* update reqs

* bump pre-commit

* remove bugbear
2023-02-19 21:33:04 +11:00
Oliver
c4a8697a5a
Django q sentry (#4296)
* add requirement for django-q-sentry

* Add sentry integration for django-q
2023-02-03 07:14:37 +11:00
Matthias Mair
ccf784d36c
Dep updates (#4176)
* test bumping deps

* bump dep file

* readd old pointer

* update pre-commit

* update req

* update dev req
2023-01-09 08:23:43 +11:00
Oliver
6fb7c85949
Update django-allauth lib version (#4141)
* Update django-allauth lib version

* Clean up requirements file

* Capital, capital
2023-01-04 06:47:58 +11:00
miggland
fdc4a46b26
Calendar export (#3858)
* Basic implementation of iCal feed

* Add calendar download to API

* Improve comments, remove unused outputs

* Basic implementation of iCal feed

* Add calendar download to API

* Improve comments, remove unused outputs

* Improve comment

* Implement filter include_completed

* update requirements.txt with pip-compile --output-file=requirements.txt requirements.in -U

* Fix less than filter

* Change URL to include calendar.ics

* Fix filtering of orders

* Remove URL/functions for calendar in views

* Lint

* More lint

* Even more style fixes

* Updated requirements-dev.txt because of style fail

* Now?

* Fine, fix it manually

* Gaaah

* Fix with same method as in common/settings.py

* Fix setting name; improve name of calendar endpoint

* Adapt InvenTreeAPITester get function to match post, etc (required for calendar test)

* Merge

* Reduce requirements.txt

* Update requirements-dev.txt

* Update tests

* Set expected codes in API calendar test

* SO completion can not work without line items; set a target date on existing orders instead

* Correct method to PATCH

* Well that didn't work for some reason.. try with cancelled orders instead

* Make sure there are more completed orders than other orders in test

* Correct wrong variable

* Lint

* Use correct status code

* Add test for unauthorized access to calendar

* Add a working test for unauthorised access

* Put the correct test in place, fix Lint

* Revert changes to requirements-dev, which appear magically...

* Lint

* Add test for basic auth

* make sample simpler

* Increment API version

Co-authored-by: Matthias Mair <code@mjmair.com>
2022-12-21 23:17:27 +11:00
Matthias Mair
fb77158496
Add news reader (#3445)
* add model for feed entries

* add task to update feed entries

* Add API routes

* Fix name in model

* rename model

* fix read endpoint

* reduce duplication in NewsFeed API endpoints

* reduce duplicated code

* add ui elements to index

* add missing migrations

* add ressource route

* add new model to admin

* reorder fields

* format timestamp

* make title linked

* reduce migrations to 1

* fix merge

* fix js style

* add model to ruleset
2022-11-10 12:20:06 +11:00
Matthias Mair
182bc29053
Add db an media backups (#3783)
* [FR] Add backup into inventrees lifecycle
Fixes #3778

* Add env to testing enviros

* block backup from running app commands

* Add more commands

* fix postgres version

* Update used env

* add daily task to run backups

* add installer changes
2022-10-17 00:09:31 +11:00
Oliver
69c3e5e222
Remove hidden characters from form fields (#3597)
* Remove control and non-printable characters from form fields (server side)

* Update regex to properly filter out control characters only

* Add regex lib to requirements flie

* Fix regex in javascript (client side)

* add required unicode flag
2022-08-24 15:12:02 +10:00
Oliver
87e7112326
Fix weasyprint version (#3539)
* Pin weasyprint version

- Revert to 54.3
- Fixes https://github.com/inventree/InvenTree/issues/3528

* Simplify label printing for multiple pages

* Simplify PDF generation for multiple report outputs

* Add content wrapper div for base label template

- Allows more extensibility
2022-08-15 11:27:27 +10:00
Oliver
412fdf246a
Bump django version (#3299) 2022-07-06 10:10:09 +10:00
Oliver
830ecd5677
Update package requirements for docker (#3285)
* Include cargo / rustc in the docker image

- Otherwise cryptography library seems to fail

* Revert cryptography lib to older version

- New version requires rust, adds ~300MB to the image size!
2022-07-03 21:44:40 +10:00
Oliver
efbef2dc90
Pin django-stdimage to sub 6.0.0 (#3273)
* Pin django-stdimage to sub 6.0.0

- 6.0.0 breaks model serialization for background worker task
- NFI why it does this

* Fix requirements file

* remove windows deps. and append requirements

* Add unit tests for encoding and offloading tasks

Co-authored-by: Matthias <code@mjmair.com>
2022-06-29 20:47:06 +10:00
Matthias Mair
cf70e4220f
Update requirements (#3228)
* Remove stat context variables

* Revert "Remove stat context variables"

This reverts commit 0989c308d0.

* remove old backport

* move requirements

* move isort

* move migrations-tests

* add pip-tools as req and add hook

* Use hashes and also run when txt files are added

* Update to hashes in requirements

* update requirements install path

* remove allauth-2fa for a test

* install dev-requirements

* re-enable allauth

* remove hashes from pre normal setup

* Remove version bindings if they are the laest

* move depencies to upper bound

* fix django-money

* remove windows specific requirements

* also install dependencies

* update markdownify

* remove django-admin-shell

* remove unneeded packages

* add docs

* remove pins and fix pre-commit pipeline

* pin django-money

* really remove admin shell

* return default behaviour for money serializer

* pip fix

* update filter name

* set decimal for output

* add migrations

* pin coveralls

* update requirements

Co-authored-by: Oliver Walters <oliver.henry.walters@gmail.com>
2022-06-28 22:12:00 +10:00