worthlesscarebears-allianceauth-buyback-program 3.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- worthlesscarebears_allianceauth_buyback_program-3.0.0/LICENSE +21 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/PKG-INFO +108 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/README.md +75 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/__init__.py +6 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/admin.py +56 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/app_settings.py +112 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/apps.py +7 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/auth_hooks.py +35 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/constants.py +60 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/decorators.py +24 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/forms.py +161 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/helpers.py +1197 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/janice/__init__.py +270 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0001_initial.py +588 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0001_initial_sde.py +741 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0002_contractnotification.py +37 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0002_eveentity_alter_contractitem_eve_type_and_more.py +36 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0003_statics_performance_increase.py +39 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0004_auto_20220323_1331.py +25 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0005_program_compression_price_dencity_modifier.py +21 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0006_program_bonds_npc_price_and_more.py +41 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0007_program_expiration.py +28 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0008_alter_general_options_alter_program_refining_rate.py +52 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0009_contract_location_name.py +17 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0010_contract_no_tracking_alter_tracking_tracking_number.py +22 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0011_delete_duplicated_contracts.py +81 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0012_make_contract_id_unique.py +17 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0013_program_discord_show_item_list.py +21 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0014_program_price_type.py +22 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0015_faq_contractnotification_header_and_more.py +38 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0016_alter_program_compression_price_dencity_modifier.py +21 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0017_alter_contract_price_alter_contract_volume_and_more.py +64 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/0018_alter_contractitem_eve_type_and_more.py +67 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/migrations/__init__.py +0 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/models.py +1642 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/notes.py +219 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/notification.py +286 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/providers.py +17 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/static/buybackprogram/css/style_dark.css +775 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/static/buybackprogram/css/style_light.css +790 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/static/buybackprogram/images/help.png +0 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/static/buybackprogram/js/autocomplete.js +19 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/static/buybackprogram/js/bootstrap-autocomplete.min.js +1 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/tasks.py +447 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/base.html +28 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/bundles/buybackprogram-css-light.html +2 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/contract_details.html +76 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/faq.html +42 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/index.html +91 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/leaderboards.html +91 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/location_add.html +48 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/page.html +8 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/base/menu-management.html +19 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/base/menu.html +44 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/calculate/accepted_locations.html +9 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/calculate/calculation_success.html +2 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/calculate/contract_settings.html +44 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/calculate/invoice.html +43 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/calculate/item_details.html +167 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/details/accepted-locations.html +11 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/details/contract-info.html +39 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/details/invoice.html +32 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/details/tabs/contract-items.html +28 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/details/tabs/original-items.html +30 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/details/tabs/tabs-navigation.html +30 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/details/warning.html +10 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/stats/summary.html +28 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/stats/tabs/finished.html +53 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/stats/tabs/outstanding.html +53 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/stats/tabs/tabs-navigation.html +43 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/stats/tabs/untracked.html +54 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/partials/stats/warning.html +6 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/performance.html +317 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/program_add.html +27 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/program_calculate.html +94 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/program_edit.html +33 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/program_edit_item.html +35 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/program_edit_marketgroup.html +35 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/program_special_taxes.html +65 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/stats.html +52 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templates/buybackprogram/user_settings.html +29 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templatetags/__init__.py +0 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templatetags/bs_tab_color_class.py +15 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templatetags/help_icons.py +31 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templatetags/price_formats.py +44 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/templatetags/program_settings.py +181 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/tests/__init__.py +0 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/tests/test_helpers.py +158 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/tests/test_models.py +874 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/tests/test_pricing.py +1038 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/tests/test_views.py +695 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/tests/testdata/__init__.py +0 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/tests/testdata/factories.py +361 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/urls.py +92 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/utils.py +145 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/views/__init__.py +3 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/views/calculate.py +218 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/views/common.py +165 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/views/programs.py +283 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/views/special_taxes.py +269 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/buybackprogram/views/stats.py +594 -0
- worthlesscarebears_allianceauth_buyback_program-3.0.0/pyproject.toml +63 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Erik Kalkoken
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: worthlesscarebears-allianceauth-buyback-program
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Summary: Buyback program plugin app for Alliance Auth.
|
|
5
|
+
Author-email: Ikarus Cesaille <contact@eve-linknet.com>
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Classifier: Environment :: Web Environment
|
|
10
|
+
Classifier: Framework :: Django
|
|
11
|
+
Classifier: Framework :: Django :: 4.2
|
|
12
|
+
Classifier: Framework :: Django :: 5.2
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
22
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: allianceauth-app-utils>=1.18.0
|
|
25
|
+
Requires-Dist: allianceauth<6.0.0,>=5
|
|
26
|
+
Requires-Dist: django-eveonline-sde>=1,<2
|
|
27
|
+
Requires-Dist: django-esi<11.0.0,>=8.3.1
|
|
28
|
+
Requires-Dist: requests>=2.33.0,<3.0.0
|
|
29
|
+
Requires-Dist: pydantic>=2.11.9,<3.0.0
|
|
30
|
+
Project-URL: Homepage, https://github.com/worthlesscarebears/allianceauth-buyback-program
|
|
31
|
+
Import-Name: buybackprogram
|
|
32
|
+
|
|
33
|
+
# Buyback Program
|
|
34
|
+
|
|
35
|
+
[](https://pypi.org/project/worthlesscarebears-allianceauth-buyback-program)
|
|
36
|
+
|
|
37
|
+
An Alliance Auth app for creating buyback programs and calculating prices for buyback contracts. Forked from [allianceauth-buyback-program](https://gitlab.com/paulipa/allianceauth-buyback-program) to use [django-eveonline-sde](https://github.com/Solar-Helix-Independent-Transport/django-eveonline-sde) and live [Janice](https://janice.e-351.com/) pricing.
|
|
38
|
+
|
|
39
|
+
## Settings
|
|
40
|
+
|
|
41
|
+
`BUYBACKPROGRAM_PRICE_JANICE_API_KEY` is required. All other settings are optional and show their defaults below.
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
# Buyback Program
|
|
45
|
+
# Janice API key used for appraisals and bulk price lookups (required)
|
|
46
|
+
BUYBACKPROGRAM_PRICE_JANICE_API_KEY = ""
|
|
47
|
+
# Janice market ID (2 = Jita 4-4)
|
|
48
|
+
BUYBACKPROGRAM_PRICE_JANICE_MARKET = 2
|
|
49
|
+
# Display name of the price source shown in the UI
|
|
50
|
+
BUYBACKPROGRAM_PRICE_SOURCE_NAME = "Jita"
|
|
51
|
+
# Use immediate 5-day median prices instead of top 5% average 5-day median prices
|
|
52
|
+
BUYBACKPROGRAM_PRICE_INSTANT_PRICES = False
|
|
53
|
+
# Cache TTL in minutes for derived ore/material prices
|
|
54
|
+
BUYBACKPROGRAM_PRICE_CACHE_TTL_MINUTES = 60
|
|
55
|
+
# Hours before a cached item price is flagged as outdated
|
|
56
|
+
BUYBACKPROGRAM_PRICE_AGE_WARNING_LIMIT = 48
|
|
57
|
+
# Prefill tag used in contract tracking descriptions
|
|
58
|
+
BUYBACKPROGRAM_TRACKING_PREFILL = "aa-bbp"
|
|
59
|
+
# Track contracts starting with the prefill tag even without a matching calculation
|
|
60
|
+
BUYBACKPROGRAM_TRACK_PREFILL_CONTRACTS = True
|
|
61
|
+
# Hours before unlinked tracking objects are purged (0 disables purging)
|
|
62
|
+
BUYBACKPROGRAM_UNUSED_TRACKING_PURGE_LIMIT = 48
|
|
63
|
+
|
|
64
|
+
# Celery beat tasks
|
|
65
|
+
CELERYBEAT_SCHEDULE["buybackprogram_update_all_prices"] = {
|
|
66
|
+
"task": "buybackprogram.tasks.update_all_prices",
|
|
67
|
+
"schedule": crontab(minute=0, hour="0"),
|
|
68
|
+
}
|
|
69
|
+
CELERYBEAT_SCHEDULE["buybackprogram_update_all_contracts"] = {
|
|
70
|
+
"task": "buybackprogram.tasks.update_all_contracts",
|
|
71
|
+
"schedule": crontab(minute="*/30"),
|
|
72
|
+
}
|
|
73
|
+
CELERYBEAT_SCHEDULE["buybackprogram_update_program_performance"] = {
|
|
74
|
+
"task": "buybackprogram.tasks.update_program_performance",
|
|
75
|
+
"schedule": crontab(minute=0, hour="0"),
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Installation
|
|
80
|
+
|
|
81
|
+
We depend on [django-eveonline-sde](https://github.com/Solar-Helix-Independent-Transport/django-eveonline-sde), so follow its setup instructions and load SDE data (`python manage.py esde_load_sde`) before configuring programs.
|
|
82
|
+
|
|
83
|
+
Install the package and add `"buybackprogram"` to `INSTALLED_APPS` in `local.py`:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pip install worthlesscarebears-allianceauth-buyback-program
|
|
87
|
+
python manage.py migrate
|
|
88
|
+
python manage.py collectstatic --no-input
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Ensure your EVE Online ESI application includes the following scopes:
|
|
92
|
+
|
|
93
|
+
- `esi-contracts.read_character_contracts.v1`
|
|
94
|
+
- `esi-contracts.read_corporation_contracts.v1`
|
|
95
|
+
- `esi-universe.read_structures.v1`
|
|
96
|
+
|
|
97
|
+
## Permissions
|
|
98
|
+
|
|
99
|
+
All permissions are under `buybackprogram | general`:
|
|
100
|
+
|
|
101
|
+
| Permission | Description |
|
|
102
|
+
| ----------------- | -------------------------------------------------------------------- |
|
|
103
|
+
| `basic_access` | Access the app, use allowed buyback programs, and view own stats. |
|
|
104
|
+
| `manage_programs` | Create and manage locations and buyback programs and view own stats. |
|
|
105
|
+
| `see_leaderboard` | View leaderboards for visible programs. |
|
|
106
|
+
| `see_performance` | View performance stats for visible programs. |
|
|
107
|
+
| `see_all_statics` | View statistics for all buyback programs. |
|
|
108
|
+
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Buyback Program
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/worthlesscarebears-allianceauth-buyback-program)
|
|
4
|
+
|
|
5
|
+
An Alliance Auth app for creating buyback programs and calculating prices for buyback contracts. Forked from [allianceauth-buyback-program](https://gitlab.com/paulipa/allianceauth-buyback-program) to use [django-eveonline-sde](https://github.com/Solar-Helix-Independent-Transport/django-eveonline-sde) and live [Janice](https://janice.e-351.com/) pricing.
|
|
6
|
+
|
|
7
|
+
## Settings
|
|
8
|
+
|
|
9
|
+
`BUYBACKPROGRAM_PRICE_JANICE_API_KEY` is required. All other settings are optional and show their defaults below.
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
# Buyback Program
|
|
13
|
+
# Janice API key used for appraisals and bulk price lookups (required)
|
|
14
|
+
BUYBACKPROGRAM_PRICE_JANICE_API_KEY = ""
|
|
15
|
+
# Janice market ID (2 = Jita 4-4)
|
|
16
|
+
BUYBACKPROGRAM_PRICE_JANICE_MARKET = 2
|
|
17
|
+
# Display name of the price source shown in the UI
|
|
18
|
+
BUYBACKPROGRAM_PRICE_SOURCE_NAME = "Jita"
|
|
19
|
+
# Use immediate 5-day median prices instead of top 5% average 5-day median prices
|
|
20
|
+
BUYBACKPROGRAM_PRICE_INSTANT_PRICES = False
|
|
21
|
+
# Cache TTL in minutes for derived ore/material prices
|
|
22
|
+
BUYBACKPROGRAM_PRICE_CACHE_TTL_MINUTES = 60
|
|
23
|
+
# Hours before a cached item price is flagged as outdated
|
|
24
|
+
BUYBACKPROGRAM_PRICE_AGE_WARNING_LIMIT = 48
|
|
25
|
+
# Prefill tag used in contract tracking descriptions
|
|
26
|
+
BUYBACKPROGRAM_TRACKING_PREFILL = "aa-bbp"
|
|
27
|
+
# Track contracts starting with the prefill tag even without a matching calculation
|
|
28
|
+
BUYBACKPROGRAM_TRACK_PREFILL_CONTRACTS = True
|
|
29
|
+
# Hours before unlinked tracking objects are purged (0 disables purging)
|
|
30
|
+
BUYBACKPROGRAM_UNUSED_TRACKING_PURGE_LIMIT = 48
|
|
31
|
+
|
|
32
|
+
# Celery beat tasks
|
|
33
|
+
CELERYBEAT_SCHEDULE["buybackprogram_update_all_prices"] = {
|
|
34
|
+
"task": "buybackprogram.tasks.update_all_prices",
|
|
35
|
+
"schedule": crontab(minute=0, hour="0"),
|
|
36
|
+
}
|
|
37
|
+
CELERYBEAT_SCHEDULE["buybackprogram_update_all_contracts"] = {
|
|
38
|
+
"task": "buybackprogram.tasks.update_all_contracts",
|
|
39
|
+
"schedule": crontab(minute="*/30"),
|
|
40
|
+
}
|
|
41
|
+
CELERYBEAT_SCHEDULE["buybackprogram_update_program_performance"] = {
|
|
42
|
+
"task": "buybackprogram.tasks.update_program_performance",
|
|
43
|
+
"schedule": crontab(minute=0, hour="0"),
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
We depend on [django-eveonline-sde](https://github.com/Solar-Helix-Independent-Transport/django-eveonline-sde), so follow its setup instructions and load SDE data (`python manage.py esde_load_sde`) before configuring programs.
|
|
50
|
+
|
|
51
|
+
Install the package and add `"buybackprogram"` to `INSTALLED_APPS` in `local.py`:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install worthlesscarebears-allianceauth-buyback-program
|
|
55
|
+
python manage.py migrate
|
|
56
|
+
python manage.py collectstatic --no-input
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Ensure your EVE Online ESI application includes the following scopes:
|
|
60
|
+
|
|
61
|
+
- `esi-contracts.read_character_contracts.v1`
|
|
62
|
+
- `esi-contracts.read_corporation_contracts.v1`
|
|
63
|
+
- `esi-universe.read_structures.v1`
|
|
64
|
+
|
|
65
|
+
## Permissions
|
|
66
|
+
|
|
67
|
+
All permissions are under `buybackprogram | general`:
|
|
68
|
+
|
|
69
|
+
| Permission | Description |
|
|
70
|
+
| ----------------- | -------------------------------------------------------------------- |
|
|
71
|
+
| `basic_access` | Access the app, use allowed buyback programs, and view own stats. |
|
|
72
|
+
| `manage_programs` | Create and manage locations and buyback programs and view own stats. |
|
|
73
|
+
| `see_leaderboard` | View leaderboards for visible programs. |
|
|
74
|
+
| `see_performance` | View performance stats for visible programs. |
|
|
75
|
+
| `see_all_statics` | View statistics for all buyback programs. |
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from django.contrib import admin
|
|
2
|
+
|
|
3
|
+
from .models import Contract, Faq, Location, Owner, Program
|
|
4
|
+
|
|
5
|
+
# Register your models here.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ProgramAdmin(admin.ModelAdmin):
|
|
9
|
+
model = Program
|
|
10
|
+
|
|
11
|
+
list_display = (
|
|
12
|
+
"owner",
|
|
13
|
+
"_location",
|
|
14
|
+
"is_corporation",
|
|
15
|
+
"hauling_fuel_cost",
|
|
16
|
+
"tax",
|
|
17
|
+
"refining_rate",
|
|
18
|
+
"price_dencity_modifier",
|
|
19
|
+
"allow_all_items",
|
|
20
|
+
"use_refined_value",
|
|
21
|
+
"use_compressed_value",
|
|
22
|
+
"use_raw_ore_value",
|
|
23
|
+
"allow_unpacked_items",
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
@classmethod
|
|
27
|
+
def _location(cls, obj):
|
|
28
|
+
names = [x.name for x in obj.location.all().order_by("name")]
|
|
29
|
+
|
|
30
|
+
if names:
|
|
31
|
+
return ", ".join(names)
|
|
32
|
+
else:
|
|
33
|
+
return None
|
|
34
|
+
|
|
35
|
+
_location.short_description = "Location"
|
|
36
|
+
_location.admin_order_field = "location__name"
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class FaqAdmin(admin.ModelAdmin):
|
|
40
|
+
model = Faq
|
|
41
|
+
|
|
42
|
+
list_display = (
|
|
43
|
+
"header",
|
|
44
|
+
"body",
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
admin.site.register(Program, ProgramAdmin)
|
|
49
|
+
|
|
50
|
+
admin.site.register(Owner)
|
|
51
|
+
|
|
52
|
+
admin.site.register(Contract)
|
|
53
|
+
|
|
54
|
+
admin.site.register(Location)
|
|
55
|
+
|
|
56
|
+
admin.site.register(Faq, FaqAdmin)
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
from django.conf import settings
|
|
4
|
+
|
|
5
|
+
from .utils import clean_setting
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def get_site_url(): # regex sso url
|
|
9
|
+
regex = r"^(.+)\/s.+"
|
|
10
|
+
matches = re.finditer(regex, settings.ESI_SSO_CALLBACK_URL, re.MULTILINE)
|
|
11
|
+
url = "http://"
|
|
12
|
+
|
|
13
|
+
for m in matches:
|
|
14
|
+
url = m.groups()[0] # first match
|
|
15
|
+
|
|
16
|
+
return url
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# Hard timeout for tasks in seconds to reduce task accumulation during outages
|
|
20
|
+
BUYBACKPROGRAM_TASKS_TIME_LIMIT = clean_setting("BUYBACKPROGRAM_TASKS_TIME_LIMIT", 7200)
|
|
21
|
+
|
|
22
|
+
# Warning limit for Jita price updates if prices have not been updated
|
|
23
|
+
BUYBACKPROGRAM_PRICE_AGE_WARNING_LIMIT = clean_setting(
|
|
24
|
+
"BUYBACKPROGRAM_PRICE_AGE_WARNING_LIMIT", 48
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
# Unused tracking purge limit
|
|
28
|
+
BUYBACKPROGRAM_UNUSED_TRACKING_PURGE_LIMIT = clean_setting(
|
|
29
|
+
"BUYBACKPROGRAM_UNUSED_TRACKING_PURGE_LIMIT", 48
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
BUYBACKPROGRAM_TRACK_PREFILL_CONTRACTS = clean_setting(
|
|
33
|
+
"BUYBACKPROGRAM_TRACK_PREFILL_CONTRACTS", True
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
# Tracking number tag
|
|
37
|
+
BUYBACKPROGRAM_TRACKING_PREFILL = clean_setting(
|
|
38
|
+
"BUYBACKPROGRAM_TRACKING_PREFILL", "aa-bbp"
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
BUYBACKPROGRAM_PRICE_SOURCE_NAME = clean_setting(
|
|
42
|
+
"BUYBACKPROGRAM_PRICE_SOURCE_NAME", "Jita"
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
BUYBACKPROGRAM_PRICE_INSTANT_PRICES = clean_setting(
|
|
46
|
+
"BUYBACKPROGRAM_PRICE_INSTANT_PRICES", False
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
BUYBACKPROGRAM_PRICE_JANICE_API_KEY = clean_setting(
|
|
50
|
+
"BUYBACKPROGRAM_PRICE_JANICE_API_KEY", ""
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
# Janice market ID (default 2 = Jita 4-4)
|
|
54
|
+
BUYBACKPROGRAM_PRICE_JANICE_MARKET = clean_setting(
|
|
55
|
+
"BUYBACKPROGRAM_PRICE_JANICE_MARKET", 2
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# Cache TTL in minutes for derived ore/material prices stored in ItemPrices
|
|
59
|
+
BUYBACKPROGRAM_PRICE_CACHE_TTL_MINUTES = clean_setting(
|
|
60
|
+
"BUYBACKPROGRAM_PRICE_CACHE_TTL_MINUTES", 60
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _get_dynamic_setting(name: str, default):
|
|
65
|
+
if hasattr(settings, name):
|
|
66
|
+
value = clean_setting(name, default)
|
|
67
|
+
return default if value is None else value
|
|
68
|
+
return globals()[name]
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def get_janice_api_key() -> str:
|
|
72
|
+
return _get_dynamic_setting("BUYBACKPROGRAM_PRICE_JANICE_API_KEY", "") or ""
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def get_janice_market() -> int:
|
|
76
|
+
return _get_dynamic_setting("BUYBACKPROGRAM_PRICE_JANICE_MARKET", 2)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def get_price_instant_prices() -> bool:
|
|
80
|
+
return bool(_get_dynamic_setting("BUYBACKPROGRAM_PRICE_INSTANT_PRICES", False))
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def get_price_cache_ttl_minutes() -> int:
|
|
84
|
+
return _get_dynamic_setting("BUYBACKPROGRAM_PRICE_CACHE_TTL_MINUTES", 60)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def get_price_age_warning_limit() -> int:
|
|
88
|
+
return _get_dynamic_setting("BUYBACKPROGRAM_PRICE_AGE_WARNING_LIMIT", 48)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def get_price_source_name() -> str:
|
|
92
|
+
return _get_dynamic_setting("BUYBACKPROGRAM_PRICE_SOURCE_NAME", "Jita")
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def get_tracking_prefill() -> str:
|
|
96
|
+
return _get_dynamic_setting("BUYBACKPROGRAM_TRACKING_PREFILL", "aa-bbp")
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def allianceauth_discordbot_active():
|
|
100
|
+
"""
|
|
101
|
+
check if allianceauth-dicordbot is installed and active
|
|
102
|
+
:return:
|
|
103
|
+
"""
|
|
104
|
+
return "aadiscordbot" in settings.INSTALLED_APPS
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def aa_discordnotify_active():
|
|
108
|
+
"""
|
|
109
|
+
check if allianceauth-dicordbot is installed and active
|
|
110
|
+
:return:
|
|
111
|
+
"""
|
|
112
|
+
return "discordnotify" in settings.INSTALLED_APPS
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from django.utils.translation import gettext_lazy as _
|
|
2
|
+
|
|
3
|
+
from allianceauth import hooks
|
|
4
|
+
from allianceauth.services.hooks import MenuItemHook, UrlHook
|
|
5
|
+
|
|
6
|
+
from . import urls
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class BuybackProgramMenuItem(MenuItemHook):
|
|
10
|
+
"""This class ensures only authorized users will see the menu entry"""
|
|
11
|
+
|
|
12
|
+
def __init__(self):
|
|
13
|
+
# setup menu entry for sidebar
|
|
14
|
+
MenuItemHook.__init__(
|
|
15
|
+
self,
|
|
16
|
+
_("Buyback Program"),
|
|
17
|
+
"fa-solid fa-store",
|
|
18
|
+
"buybackprogram:index",
|
|
19
|
+
navactive=["buybackprogram:"],
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
def render(self, request):
|
|
23
|
+
if request.user.has_perm("buybackprogram.basic_access"):
|
|
24
|
+
return MenuItemHook.render(self, request)
|
|
25
|
+
return ""
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@hooks.register("menu_item_hook")
|
|
29
|
+
def register_menu():
|
|
30
|
+
return BuybackProgramMenuItem()
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@hooks.register("url_hook")
|
|
34
|
+
def register_urls():
|
|
35
|
+
return UrlHook(urls, "buybackprogram", r"^buybackprogram/")
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
ASTEROID_CATEGORY_ID = 25
|
|
2
|
+
BLUEPRINT_CATEGORY_ID = 9
|
|
3
|
+
|
|
4
|
+
# Includes all asteroids, moon ore and ice. All items that can be compressed or refined for minerals*
|
|
5
|
+
ORE_EVE_GROUPS = [
|
|
6
|
+
450, # Arkonor
|
|
7
|
+
451, # Bistot
|
|
8
|
+
452, # Crokite
|
|
9
|
+
453, # Ochre
|
|
10
|
+
454, # Hedbergite
|
|
11
|
+
455, # Hemorphite
|
|
12
|
+
456, # Jaspet
|
|
13
|
+
457, # Kernite
|
|
14
|
+
458, # Plagioclase
|
|
15
|
+
459, # Pyroxeres
|
|
16
|
+
460, # Scordite
|
|
17
|
+
461, # Spodumain
|
|
18
|
+
462, # Veldspar
|
|
19
|
+
465, # Ice
|
|
20
|
+
467, # Gneiss
|
|
21
|
+
468, # Mercoxit
|
|
22
|
+
469, # Omber
|
|
23
|
+
1884, # Zeolites
|
|
24
|
+
1911, # Raspite
|
|
25
|
+
1920, # Cobaltite
|
|
26
|
+
1921, # Otavite
|
|
27
|
+
1922, # Carnotite
|
|
28
|
+
1923, # Xenotime
|
|
29
|
+
2024, # Amethystic Crystallite
|
|
30
|
+
2029, # ??
|
|
31
|
+
4029, # Talassonite
|
|
32
|
+
4030, # Rakovene
|
|
33
|
+
4031, # Bezdnacine
|
|
34
|
+
4094, # ??
|
|
35
|
+
4513, # Mordunium
|
|
36
|
+
4514, # Ytirium
|
|
37
|
+
4515, # Eifyrium
|
|
38
|
+
4516, # Ducinium
|
|
39
|
+
4759, # Griemeer
|
|
40
|
+
4758, # Hezorime
|
|
41
|
+
4755, # Kylixium
|
|
42
|
+
4756, # Nocxite
|
|
43
|
+
4757, # Ueganite
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
OPE_EVE_GROUPS = [493]
|
|
47
|
+
|
|
48
|
+
BONDS_EVE_GROUPS = [1248]
|
|
49
|
+
|
|
50
|
+
BLUE_LOOT_TYPE_IDS = [
|
|
51
|
+
30744,
|
|
52
|
+
30745,
|
|
53
|
+
30746,
|
|
54
|
+
30747,
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
RED_LOOT_TYPE_IDS = [
|
|
58
|
+
48121,
|
|
59
|
+
60459,
|
|
60
|
+
]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from functools import wraps
|
|
2
|
+
|
|
3
|
+
from esi.errors import TokenError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def fetch_token_for_owner(scopes):
|
|
7
|
+
"""returns valid token for owner.
|
|
8
|
+
Needs to be attached on an Owner method !!
|
|
9
|
+
|
|
10
|
+
Args:
|
|
11
|
+
-scopes: Provide the required scopes.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def decorator(func):
|
|
15
|
+
@wraps(func)
|
|
16
|
+
def _wrapped_view(owner, *args, **kwargs):
|
|
17
|
+
token, error = owner.token(scopes)
|
|
18
|
+
if error:
|
|
19
|
+
raise TokenError
|
|
20
|
+
return func(owner, token, *args, **kwargs)
|
|
21
|
+
|
|
22
|
+
return _wrapped_view
|
|
23
|
+
|
|
24
|
+
return decorator
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
from django import forms
|
|
2
|
+
from django.core.validators import MaxValueValidator, MinValueValidator
|
|
3
|
+
from django.utils.translation import gettext as _
|
|
4
|
+
from eve_sde.models import ItemMarketGroup, ItemType, SolarSystem
|
|
5
|
+
|
|
6
|
+
from buybackprogram.models import Location, Owner, Program, UserSettings
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ProgramForm(forms.ModelForm):
|
|
10
|
+
# specify the name of model to use
|
|
11
|
+
class Meta:
|
|
12
|
+
model = Program
|
|
13
|
+
fields = "__all__"
|
|
14
|
+
labels = {
|
|
15
|
+
"price_dencity_modifier": "Price density modifier",
|
|
16
|
+
"price_dencity_treshold": "Price density threshold",
|
|
17
|
+
"price_dencity_tax": "Price density tax",
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
def __init__(self, *args, **kwargs):
|
|
21
|
+
self.user = kwargs.pop("user", None)
|
|
22
|
+
|
|
23
|
+
super(ProgramForm, self).__init__(*args, **kwargs)
|
|
24
|
+
self.fields["owner"].queryset = Owner.objects.filter(user=self.user)
|
|
25
|
+
self.fields["location"].queryset = Location.objects.filter(
|
|
26
|
+
owner__user=self.user
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ProgramItemForm(forms.Form):
|
|
31
|
+
item_type = forms.ModelChoiceField(
|
|
32
|
+
queryset=ItemType.objects.none(),
|
|
33
|
+
label="Item type",
|
|
34
|
+
help_text="Add the name of item which you want to determine an tax on. Once you start typing, we offer suggestions",
|
|
35
|
+
empty_label=None,
|
|
36
|
+
)
|
|
37
|
+
item_tax = forms.IntegerField(
|
|
38
|
+
label="Tax amount",
|
|
39
|
+
initial=0,
|
|
40
|
+
validators=[MaxValueValidator(100), MinValueValidator(-100)],
|
|
41
|
+
help_text="Set an tax on the item. If program default tax is defined this tax will be added on top of the program tax. If program does not allow all items this tax is used to calculate the tax for the product.",
|
|
42
|
+
)
|
|
43
|
+
disallow_item = forms.BooleanField(
|
|
44
|
+
label="Disallow item in this program",
|
|
45
|
+
help_text="If you want to prevent any prices to be given for this item in this program you can check this box.",
|
|
46
|
+
required=False,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
def __init__(self, *args, **kwargs):
|
|
50
|
+
value = kwargs.pop("value", None)
|
|
51
|
+
|
|
52
|
+
super(ProgramItemForm, self).__init__(*args, **kwargs)
|
|
53
|
+
|
|
54
|
+
if value is not None:
|
|
55
|
+
self.fields["item_type"].queryset = ItemType.objects.filter(
|
|
56
|
+
pk=value,
|
|
57
|
+
published=True,
|
|
58
|
+
).exclude(group__category__id=9)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class ProgramMarketGroupForm(forms.Form):
|
|
62
|
+
marketgroup = forms.ModelChoiceField(
|
|
63
|
+
queryset=ItemMarketGroup.objects.none(),
|
|
64
|
+
label="Item type",
|
|
65
|
+
help_text="Add the name of item which you want to determine an tax on. Once you start typing, we offer suggestions",
|
|
66
|
+
empty_label=None,
|
|
67
|
+
)
|
|
68
|
+
item_tax = forms.IntegerField(
|
|
69
|
+
label="Tax amount",
|
|
70
|
+
initial=0,
|
|
71
|
+
validators=[MaxValueValidator(100), MinValueValidator(-100)],
|
|
72
|
+
help_text="Set an tax on the item. If program default tax is defined this tax will be added on top of the program tax. If program does not allow all items this tax is used to calculate the tax for the product.",
|
|
73
|
+
)
|
|
74
|
+
disallow_item = forms.BooleanField(
|
|
75
|
+
label="Disallow item in this program",
|
|
76
|
+
help_text="If you want to prevent any prices to be given for this item in this program you can check this box.",
|
|
77
|
+
required=False,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
def __init__(self, *args, **kwargs):
|
|
81
|
+
value = kwargs.pop("value", None)
|
|
82
|
+
|
|
83
|
+
super(ProgramMarketGroupForm, self).__init__(*args, **kwargs)
|
|
84
|
+
|
|
85
|
+
if value is not None:
|
|
86
|
+
self.fields["marketgroup"].queryset = ItemMarketGroup.objects.filter(
|
|
87
|
+
pk=value,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class LocationForm(forms.Form):
|
|
92
|
+
eve_solar_system = forms.ModelChoiceField(
|
|
93
|
+
queryset=SolarSystem.objects.none(),
|
|
94
|
+
label="Solar system",
|
|
95
|
+
help_text="Select solar system name. Start typing and we will give you suggestions.",
|
|
96
|
+
empty_label=None,
|
|
97
|
+
)
|
|
98
|
+
name = forms.CharField(
|
|
99
|
+
label="Structure/station name",
|
|
100
|
+
help_text="A name or identification tag of the structure where the items should be contracted at. Does not need to match ingame name.",
|
|
101
|
+
max_length=32,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
structure_id = forms.IntegerField(
|
|
105
|
+
required=False,
|
|
106
|
+
label="Structure/station ID",
|
|
107
|
+
help_text="The ingame ID for the structure you wish to accept the contracts at. <strong>If left empty the program statistics page will not track if the contract is actually made at the correct structure or not.</strong>",
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
def __init__(self, *args, **kwargs):
|
|
111
|
+
value = kwargs.pop("value", None)
|
|
112
|
+
self.user = kwargs.pop("user", None)
|
|
113
|
+
|
|
114
|
+
super(LocationForm, self).__init__(*args, **kwargs)
|
|
115
|
+
|
|
116
|
+
if value is not None:
|
|
117
|
+
self.fields["eve_solar_system"].queryset = SolarSystem.objects.filter(
|
|
118
|
+
pk=value,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class CalculatorForm(forms.Form):
|
|
123
|
+
items = forms.CharField(
|
|
124
|
+
widget=forms.Textarea,
|
|
125
|
+
label="Items",
|
|
126
|
+
help_text="Copy and paste the item data from your inventory. Item types not in this buyback program will be ignored",
|
|
127
|
+
)
|
|
128
|
+
donation = forms.IntegerField(
|
|
129
|
+
label="Donation %",
|
|
130
|
+
initial=0,
|
|
131
|
+
help_text="You can set a optional donation percentage on your contract",
|
|
132
|
+
validators=[MaxValueValidator(100), MinValueValidator(0)],
|
|
133
|
+
)
|
|
134
|
+
additional_notes = forms.CharField(
|
|
135
|
+
label="Additional Notes",
|
|
136
|
+
help_text="You can set additional notes for your contract in here",
|
|
137
|
+
required=False, # Make sure it's not required
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class UserSettingsForm(forms.ModelForm):
|
|
142
|
+
"""
|
|
143
|
+
User settings form
|
|
144
|
+
"""
|
|
145
|
+
|
|
146
|
+
disable_notifications = forms.BooleanField(
|
|
147
|
+
initial=False,
|
|
148
|
+
required=False,
|
|
149
|
+
label=_(
|
|
150
|
+
"Disable notifications. "
|
|
151
|
+
"(Auth and Discord, if a relevant module is installed)"
|
|
152
|
+
),
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
class Meta: # pylint: disable=too-few-public-methods
|
|
156
|
+
"""
|
|
157
|
+
Meta definitions
|
|
158
|
+
"""
|
|
159
|
+
|
|
160
|
+
model = UserSettings
|
|
161
|
+
fields = ["disable_notifications"]
|