pretix-map 0.0.3__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.
- pretix_map-0.0.3/LICENSE +15 -0
- pretix_map-0.0.3/MANIFEST.in +5 -0
- pretix_map-0.0.3/PKG-INFO +193 -0
- pretix_map-0.0.3/README.rst +178 -0
- pretix_map-0.0.3/pretix_map.egg-info/PKG-INFO +193 -0
- pretix_map-0.0.3/pretix_map.egg-info/SOURCES.txt +52 -0
- pretix_map-0.0.3/pretix_map.egg-info/dependency_links.txt +1 -0
- pretix_map-0.0.3/pretix_map.egg-info/entry_points.txt +5 -0
- pretix_map-0.0.3/pretix_map.egg-info/requires.txt +1 -0
- pretix_map-0.0.3/pretix_map.egg-info/top_level.txt +1 -0
- pretix_map-0.0.3/pretix_mapplugin/__init__.py +1 -0
- pretix_map-0.0.3/pretix_mapplugin/apps.py +28 -0
- pretix_map-0.0.3/pretix_mapplugin/geocoding.py +113 -0
- pretix_map-0.0.3/pretix_mapplugin/locale/de/LC_MESSAGES/django.mo +0 -0
- pretix_map-0.0.3/pretix_mapplugin/locale/de/LC_MESSAGES/django.po +12 -0
- pretix_map-0.0.3/pretix_mapplugin/locale/de_Informal/.gitkeep +0 -0
- pretix_map-0.0.3/pretix_mapplugin/locale/de_Informal/LC_MESSAGES/django.mo +0 -0
- pretix_map-0.0.3/pretix_mapplugin/locale/de_Informal/LC_MESSAGES/django.po +12 -0
- pretix_map-0.0.3/pretix_mapplugin/management/__init__.py +0 -0
- pretix_map-0.0.3/pretix_mapplugin/management/commands/__init__.py +0 -0
- pretix_map-0.0.3/pretix_mapplugin/management/commands/geocode_existing_orders.py +167 -0
- pretix_map-0.0.3/pretix_mapplugin/migrations/__init__.py +0 -0
- pretix_map-0.0.3/pretix_mapplugin/models.py +27 -0
- pretix_map-0.0.3/pretix_mapplugin/signals.py +73 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/.gitkeep +0 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/css/salesmap.css +19 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/js/salesmap.js +378 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/MarkerCluster.Default.css +60 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/MarkerCluster.css +14 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/images/layers-2x.png +0 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/images/layers.png +0 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/images/marker-icon-2x.png +0 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/images/marker-icon.png +0 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/images/marker-shadow.png +0 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet-heat.js +11 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet-src.esm.js +14419 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet-src.esm.js.map +1 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet-src.js +14512 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet-src.js.map +1 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet.css +661 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet.js +6 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet.js.map +1 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet.markercluster.js +3 -0
- pretix_map-0.0.3/pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet.markercluster.js.map +1 -0
- pretix_map-0.0.3/pretix_mapplugin/tasks.py +74 -0
- pretix_map-0.0.3/pretix_mapplugin/templates/pretix_mapplugin/.gitkeep +0 -0
- pretix_map-0.0.3/pretix_mapplugin/templates/pretix_mapplugin/map_page.html +45 -0
- pretix_map-0.0.3/pretix_mapplugin/urls.py +21 -0
- pretix_map-0.0.3/pretix_mapplugin/views.py +163 -0
- pretix_map-0.0.3/pyproject.toml +44 -0
- pretix_map-0.0.3/setup.cfg +49 -0
- pretix_map-0.0.3/setup.py +3 -0
- pretix_map-0.0.3/tests/test_main.py +3 -0
pretix_map-0.0.3/LICENSE
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
Copyright 2025 MarkenJaden
|
3
|
+
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
15
|
+
|
@@ -0,0 +1,193 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: pretix-map
|
3
|
+
Version: 0.0.3
|
4
|
+
Summary: An overview map of the catchment area of previous orders. Measured by postcode
|
5
|
+
Author-email: MarkenJaden <jjsch1410@gmail.com>
|
6
|
+
Maintainer-email: MarkenJaden <jjsch1410@gmail.com>
|
7
|
+
License: Apache
|
8
|
+
Project-URL: homepage, https://github.com/MarkenJaden/pretix-map
|
9
|
+
Project-URL: repository, https://github.com/MarkenJaden/pretix-map
|
10
|
+
Keywords: pretix
|
11
|
+
Description-Content-Type: text/x-rst
|
12
|
+
License-File: LICENSE
|
13
|
+
Requires-Dist: geopy
|
14
|
+
Dynamic: license-file
|
15
|
+
|
16
|
+
Map-Plugin
|
17
|
+
==========================
|
18
|
+
|
19
|
+
This is a plugin for `pretix`_.
|
20
|
+
|
21
|
+
It provides an overview map visualizing the geographic location of attendees based on the addresses provided in their orders. The plugin automatically geocodes order addresses upon payment and displays the locations on an interactive map within the event control panel.
|
22
|
+
|
23
|
+
Features:
|
24
|
+
|
25
|
+
* Automatic geocoding of paid order addresses using a configured geocoding service.
|
26
|
+
* Interactive map display (Leaflet) showing locations as clustered pins or a heatmap.
|
27
|
+
* Option to toggle between pin view and heatmap view.
|
28
|
+
* Pins show tooltips with Order Code, Date, and Item Count on hover.
|
29
|
+
* Clicking a pin navigates directly to the corresponding order details page.
|
30
|
+
* Adds a "Sales Map" link to the event navigation sidebar.
|
31
|
+
* Includes a management command to geocode orders placed *before* the plugin was installed or configured.
|
32
|
+
|
33
|
+
Requirements
|
34
|
+
------------
|
35
|
+
|
36
|
+
* A working `pretix installation`_.
|
37
|
+
* A **Celery worker** configured and running for your Pretix instance. This is essential for the background geocoding tasks.
|
38
|
+
* Access to a **Geocoding Service**. This plugin requires configuration to use an external service to convert addresses to latitude/longitude coordinates. See the **Configuration** section below.
|
39
|
+
|
40
|
+
|
41
|
+
Installation (Production)
|
42
|
+
--------------------------
|
43
|
+
|
44
|
+
1. Ensure you meet the requirements above, especially a running Celery worker.
|
45
|
+
2. Activate the virtual environment used for your Pretix installation.
|
46
|
+
3. Install the plugin via pip:
|
47
|
+
|
48
|
+
.. code-block:: bash
|
49
|
+
|
50
|
+
pip install pretix-map-plugin
|
51
|
+
|
52
|
+
*(Note: If the plugin is not on PyPI yet, you might need to install from the git repository URL)*
|
53
|
+
4. Configure the required geocoding service settings in your `pretix.cfg` file (see **Configuration** below).
|
54
|
+
5. Restart your Pretix webserver (`gunicorn`/`uwsgi`) **and** your Pretix Celery worker(s).
|
55
|
+
6. Log in to your Pretix backend and go to Organizer Settings -> Plugins. Enable the "Sales Map" plugin for the desired organizer(s).
|
56
|
+
7. Go into an event, then navigate to Event Settings -> Plugins and ensure the "Sales Map" plugin is checked (enabled) for that event.
|
57
|
+
|
58
|
+
|
59
|
+
Configuration (`pretix.cfg`)
|
60
|
+
------------------------------
|
61
|
+
|
62
|
+
This plugin requires configuration in your `pretix.cfg` file to specify which geocoding service to use. Add a section `[pretix_mapplugin]` if it doesn't exist.
|
63
|
+
|
64
|
+
**Required Setting (Choose ONE method):**
|
65
|
+
|
66
|
+
* **Method 1: Nominatim (OpenStreetMap - Free, Requires User-Agent)**
|
67
|
+
Nominatim is a free geocoding service based on OpenStreetMap data. It has usage policies that **require** you to set a descriptive User-Agent header, typically including your application name and contact email. Failure to do so may result in your IP being blocked.
|
68
|
+
|
69
|
+
.. code-block:: ini
|
70
|
+
|
71
|
+
[pretix_mapplugin]
|
72
|
+
# REQUIRED for Nominatim: Set a descriptive User-Agent including application name and contact info.
|
73
|
+
# Replace with your actual details! See: https://operations.osmfoundation.org/policies/nominatim/
|
74
|
+
nominatim_user_agent=YourTicketingSite/1.0 (Contact: admin@yourdomain.com) pretix-map-plugin/1.0
|
75
|
+
|
76
|
+
* **Method 2: Other Geocoding Services (e.g., Google, Mapbox - API Key likely needed)**
|
77
|
+
*(This example assumes you have modified `tasks.py` to use a different geocoder like GeoPy with GoogleV3. Adjust the setting name and value based on your implementation.)*
|
78
|
+
|
79
|
+
.. code-block:: ini
|
80
|
+
|
81
|
+
[pretix_mapplugin]
|
82
|
+
# Example for Google Geocoding API (if implemented in tasks.py)
|
83
|
+
# google_geocoding_api_key=YOUR_GOOGLE_GEOCODING_API_KEY
|
84
|
+
|
85
|
+
**Important:** After adding or changing settings in `pretix.cfg`, you **must restart** the Pretix webserver and Celery workers for the changes to take effect.
|
86
|
+
|
87
|
+
Usage
|
88
|
+
-----
|
89
|
+
|
90
|
+
1. Once installed, configured, and enabled, the plugin works mostly automatically.
|
91
|
+
2. When an order is marked as paid, a background task is queued to geocode the address associated with the order (typically the invoice address). This requires your Celery worker to be running.
|
92
|
+
3. A "Sales Map" link will appear in the event control panel's sidebar navigation (usually near other order-related items or plugin links) for users with the "Can view orders" permission.
|
93
|
+
4. Clicking this link displays the map. You can toggle between the pin view (markers clustered) and the heatmap view using the button provided.
|
94
|
+
5. In the pin view:
|
95
|
+
|
96
|
+
* Hover over a marker cluster to see the number of orders it represents.
|
97
|
+
* Zoom in to break clusters apart.
|
98
|
+
* Hover over an individual pin to see a tooltip with Order Code, Date, and Item Count.
|
99
|
+
* Click an individual pin to open the corresponding order details page in a new tab.
|
100
|
+
|
101
|
+
Management Command: `geocode_existing_orders`
|
102
|
+
---------------------------------------------
|
103
|
+
|
104
|
+
This command is essential for processing orders that were placed *before* the map plugin was installed, enabled, or correctly configured with geocoding credentials. It scans paid orders and queues geocoding tasks for those that haven't been geocoded yet.
|
105
|
+
|
106
|
+
**When to Run:**
|
107
|
+
|
108
|
+
* After installing and configuring the plugin for the first time.
|
109
|
+
* If you previously ran the plugin without a working geocoding configuration or Celery worker.
|
110
|
+
* If you want to force-reprocess orders (e.g., if geocoding logic changed).
|
111
|
+
|
112
|
+
**Prerequisites:**
|
113
|
+
|
114
|
+
* Your Pretix Celery worker **must** be running to process the tasks queued by this command.
|
115
|
+
* Geocoding settings must be correctly configured in `pretix.cfg`.
|
116
|
+
|
117
|
+
**How to Run:**
|
118
|
+
|
119
|
+
1. Navigate to your Pretix installation directory (containing `manage.py`) in your server terminal.
|
120
|
+
2. Activate your Pretix virtual environment.
|
121
|
+
3. Execute the command using `manage.py`.
|
122
|
+
|
123
|
+
**Basic Command:**
|
124
|
+
|
125
|
+
.. code-block:: bash
|
126
|
+
|
127
|
+
python manage.py geocode_existing_orders [options]
|
128
|
+
|
129
|
+
**Available Options:**
|
130
|
+
|
131
|
+
* `--organizer <slug>`: Process orders only for the organizer with the given slug.
|
132
|
+
* Example: `python manage.py geocode_existing_orders --organizer=myorg`
|
133
|
+
* `--event <slug>`: Process orders only for the event with the given slug. **Requires** `--organizer` to be specified as well.
|
134
|
+
* Example: `python manage.py geocode_existing_orders --organizer=myorg --event=myevent2024`
|
135
|
+
* `--dry-run`: **Highly Recommended for first use!** Simulates the process and shows which orders *would* be queued, but doesn't actually queue any tasks. Use this to verify the scope and count before running for real.
|
136
|
+
* Example: `python manage.py geocode_existing_orders --dry-run`
|
137
|
+
* `--force-recode`: Queues geocoding tasks even for orders that already have an entry in the geocoding data table. Use this if you suspect previous geocoding attempts were incomplete or incorrect, or if the geocoding logic has been updated.
|
138
|
+
* Example: `python manage.py geocode_existing_orders --organizer=myorg --force-recode`
|
139
|
+
|
140
|
+
**Example Workflow:**
|
141
|
+
|
142
|
+
1. **Test with Dry Run (All Organizers):**
|
143
|
+
.. code-block:: bash
|
144
|
+
|
145
|
+
python manage.py geocode_existing_orders --dry-run
|
146
|
+
2. **(If satisfied) Run for Real (All Organizers):**
|
147
|
+
.. code-block:: bash
|
148
|
+
|
149
|
+
python manage.py geocode_existing_orders
|
150
|
+
3. **Monitor your Celery worker** logs to ensure tasks are being processed without errors.
|
151
|
+
|
152
|
+
|
153
|
+
Development setup
|
154
|
+
-----------------
|
155
|
+
|
156
|
+
1. Make sure that you have a working `pretix development setup`_. Ensure your dev setup includes a running Celery worker if you want to test the background tasks.
|
157
|
+
2. Clone this repository.
|
158
|
+
3. Activate the virtual environment you use for pretix development.
|
159
|
+
4. Execute ``python setup.py develop`` within this directory to register this application with pretix's plugin registry.
|
160
|
+
5. Execute ``make`` within this directory to compile translations.
|
161
|
+
6. **Configure Geocoding:** Add the necessary geocoding settings (e.g., `nominatim_user_agent`) to your local `pretix.cfg` file for testing the geocoding feature.
|
162
|
+
7. Restart your local pretix server and Celery worker. You can now use the plugin from this repository for your events by enabling it in the 'plugins' tab in the settings.
|
163
|
+
|
164
|
+
This plugin has CI set up to enforce a few code style rules. To check locally, you need these packages installed::
|
165
|
+
|
166
|
+
pip install flake8 isort black
|
167
|
+
|
168
|
+
To check your plugin for rule violations, run::
|
169
|
+
|
170
|
+
black --check .
|
171
|
+
isort -c .
|
172
|
+
flake8 .
|
173
|
+
|
174
|
+
You can auto-fix some of these issues by running::
|
175
|
+
|
176
|
+
isort .
|
177
|
+
black .
|
178
|
+
|
179
|
+
To automatically check for these issues before you commit, you can run ``.install-hooks``.
|
180
|
+
|
181
|
+
|
182
|
+
License
|
183
|
+
-------
|
184
|
+
|
185
|
+
Copyright 2025 MarkenJaden
|
186
|
+
|
187
|
+
Released under the terms of the Apache License 2.0
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
.. _pretix: https://github.com/pretix/pretix
|
192
|
+
.. _pretix installation: https://docs.pretix.eu/en/latest/administrator/installation/index.html
|
193
|
+
.. _pretix development setup: https://docs.pretix.eu/en/latest/development/setup.html
|
@@ -0,0 +1,178 @@
|
|
1
|
+
Map-Plugin
|
2
|
+
==========================
|
3
|
+
|
4
|
+
This is a plugin for `pretix`_.
|
5
|
+
|
6
|
+
It provides an overview map visualizing the geographic location of attendees based on the addresses provided in their orders. The plugin automatically geocodes order addresses upon payment and displays the locations on an interactive map within the event control panel.
|
7
|
+
|
8
|
+
Features:
|
9
|
+
|
10
|
+
* Automatic geocoding of paid order addresses using a configured geocoding service.
|
11
|
+
* Interactive map display (Leaflet) showing locations as clustered pins or a heatmap.
|
12
|
+
* Option to toggle between pin view and heatmap view.
|
13
|
+
* Pins show tooltips with Order Code, Date, and Item Count on hover.
|
14
|
+
* Clicking a pin navigates directly to the corresponding order details page.
|
15
|
+
* Adds a "Sales Map" link to the event navigation sidebar.
|
16
|
+
* Includes a management command to geocode orders placed *before* the plugin was installed or configured.
|
17
|
+
|
18
|
+
Requirements
|
19
|
+
------------
|
20
|
+
|
21
|
+
* A working `pretix installation`_.
|
22
|
+
* A **Celery worker** configured and running for your Pretix instance. This is essential for the background geocoding tasks.
|
23
|
+
* Access to a **Geocoding Service**. This plugin requires configuration to use an external service to convert addresses to latitude/longitude coordinates. See the **Configuration** section below.
|
24
|
+
|
25
|
+
|
26
|
+
Installation (Production)
|
27
|
+
--------------------------
|
28
|
+
|
29
|
+
1. Ensure you meet the requirements above, especially a running Celery worker.
|
30
|
+
2. Activate the virtual environment used for your Pretix installation.
|
31
|
+
3. Install the plugin via pip:
|
32
|
+
|
33
|
+
.. code-block:: bash
|
34
|
+
|
35
|
+
pip install pretix-map-plugin
|
36
|
+
|
37
|
+
*(Note: If the plugin is not on PyPI yet, you might need to install from the git repository URL)*
|
38
|
+
4. Configure the required geocoding service settings in your `pretix.cfg` file (see **Configuration** below).
|
39
|
+
5. Restart your Pretix webserver (`gunicorn`/`uwsgi`) **and** your Pretix Celery worker(s).
|
40
|
+
6. Log in to your Pretix backend and go to Organizer Settings -> Plugins. Enable the "Sales Map" plugin for the desired organizer(s).
|
41
|
+
7. Go into an event, then navigate to Event Settings -> Plugins and ensure the "Sales Map" plugin is checked (enabled) for that event.
|
42
|
+
|
43
|
+
|
44
|
+
Configuration (`pretix.cfg`)
|
45
|
+
------------------------------
|
46
|
+
|
47
|
+
This plugin requires configuration in your `pretix.cfg` file to specify which geocoding service to use. Add a section `[pretix_mapplugin]` if it doesn't exist.
|
48
|
+
|
49
|
+
**Required Setting (Choose ONE method):**
|
50
|
+
|
51
|
+
* **Method 1: Nominatim (OpenStreetMap - Free, Requires User-Agent)**
|
52
|
+
Nominatim is a free geocoding service based on OpenStreetMap data. It has usage policies that **require** you to set a descriptive User-Agent header, typically including your application name and contact email. Failure to do so may result in your IP being blocked.
|
53
|
+
|
54
|
+
.. code-block:: ini
|
55
|
+
|
56
|
+
[pretix_mapplugin]
|
57
|
+
# REQUIRED for Nominatim: Set a descriptive User-Agent including application name and contact info.
|
58
|
+
# Replace with your actual details! See: https://operations.osmfoundation.org/policies/nominatim/
|
59
|
+
nominatim_user_agent=YourTicketingSite/1.0 (Contact: admin@yourdomain.com) pretix-map-plugin/1.0
|
60
|
+
|
61
|
+
* **Method 2: Other Geocoding Services (e.g., Google, Mapbox - API Key likely needed)**
|
62
|
+
*(This example assumes you have modified `tasks.py` to use a different geocoder like GeoPy with GoogleV3. Adjust the setting name and value based on your implementation.)*
|
63
|
+
|
64
|
+
.. code-block:: ini
|
65
|
+
|
66
|
+
[pretix_mapplugin]
|
67
|
+
# Example for Google Geocoding API (if implemented in tasks.py)
|
68
|
+
# google_geocoding_api_key=YOUR_GOOGLE_GEOCODING_API_KEY
|
69
|
+
|
70
|
+
**Important:** After adding or changing settings in `pretix.cfg`, you **must restart** the Pretix webserver and Celery workers for the changes to take effect.
|
71
|
+
|
72
|
+
Usage
|
73
|
+
-----
|
74
|
+
|
75
|
+
1. Once installed, configured, and enabled, the plugin works mostly automatically.
|
76
|
+
2. When an order is marked as paid, a background task is queued to geocode the address associated with the order (typically the invoice address). This requires your Celery worker to be running.
|
77
|
+
3. A "Sales Map" link will appear in the event control panel's sidebar navigation (usually near other order-related items or plugin links) for users with the "Can view orders" permission.
|
78
|
+
4. Clicking this link displays the map. You can toggle between the pin view (markers clustered) and the heatmap view using the button provided.
|
79
|
+
5. In the pin view:
|
80
|
+
|
81
|
+
* Hover over a marker cluster to see the number of orders it represents.
|
82
|
+
* Zoom in to break clusters apart.
|
83
|
+
* Hover over an individual pin to see a tooltip with Order Code, Date, and Item Count.
|
84
|
+
* Click an individual pin to open the corresponding order details page in a new tab.
|
85
|
+
|
86
|
+
Management Command: `geocode_existing_orders`
|
87
|
+
---------------------------------------------
|
88
|
+
|
89
|
+
This command is essential for processing orders that were placed *before* the map plugin was installed, enabled, or correctly configured with geocoding credentials. It scans paid orders and queues geocoding tasks for those that haven't been geocoded yet.
|
90
|
+
|
91
|
+
**When to Run:**
|
92
|
+
|
93
|
+
* After installing and configuring the plugin for the first time.
|
94
|
+
* If you previously ran the plugin without a working geocoding configuration or Celery worker.
|
95
|
+
* If you want to force-reprocess orders (e.g., if geocoding logic changed).
|
96
|
+
|
97
|
+
**Prerequisites:**
|
98
|
+
|
99
|
+
* Your Pretix Celery worker **must** be running to process the tasks queued by this command.
|
100
|
+
* Geocoding settings must be correctly configured in `pretix.cfg`.
|
101
|
+
|
102
|
+
**How to Run:**
|
103
|
+
|
104
|
+
1. Navigate to your Pretix installation directory (containing `manage.py`) in your server terminal.
|
105
|
+
2. Activate your Pretix virtual environment.
|
106
|
+
3. Execute the command using `manage.py`.
|
107
|
+
|
108
|
+
**Basic Command:**
|
109
|
+
|
110
|
+
.. code-block:: bash
|
111
|
+
|
112
|
+
python manage.py geocode_existing_orders [options]
|
113
|
+
|
114
|
+
**Available Options:**
|
115
|
+
|
116
|
+
* `--organizer <slug>`: Process orders only for the organizer with the given slug.
|
117
|
+
* Example: `python manage.py geocode_existing_orders --organizer=myorg`
|
118
|
+
* `--event <slug>`: Process orders only for the event with the given slug. **Requires** `--organizer` to be specified as well.
|
119
|
+
* Example: `python manage.py geocode_existing_orders --organizer=myorg --event=myevent2024`
|
120
|
+
* `--dry-run`: **Highly Recommended for first use!** Simulates the process and shows which orders *would* be queued, but doesn't actually queue any tasks. Use this to verify the scope and count before running for real.
|
121
|
+
* Example: `python manage.py geocode_existing_orders --dry-run`
|
122
|
+
* `--force-recode`: Queues geocoding tasks even for orders that already have an entry in the geocoding data table. Use this if you suspect previous geocoding attempts were incomplete or incorrect, or if the geocoding logic has been updated.
|
123
|
+
* Example: `python manage.py geocode_existing_orders --organizer=myorg --force-recode`
|
124
|
+
|
125
|
+
**Example Workflow:**
|
126
|
+
|
127
|
+
1. **Test with Dry Run (All Organizers):**
|
128
|
+
.. code-block:: bash
|
129
|
+
|
130
|
+
python manage.py geocode_existing_orders --dry-run
|
131
|
+
2. **(If satisfied) Run for Real (All Organizers):**
|
132
|
+
.. code-block:: bash
|
133
|
+
|
134
|
+
python manage.py geocode_existing_orders
|
135
|
+
3. **Monitor your Celery worker** logs to ensure tasks are being processed without errors.
|
136
|
+
|
137
|
+
|
138
|
+
Development setup
|
139
|
+
-----------------
|
140
|
+
|
141
|
+
1. Make sure that you have a working `pretix development setup`_. Ensure your dev setup includes a running Celery worker if you want to test the background tasks.
|
142
|
+
2. Clone this repository.
|
143
|
+
3. Activate the virtual environment you use for pretix development.
|
144
|
+
4. Execute ``python setup.py develop`` within this directory to register this application with pretix's plugin registry.
|
145
|
+
5. Execute ``make`` within this directory to compile translations.
|
146
|
+
6. **Configure Geocoding:** Add the necessary geocoding settings (e.g., `nominatim_user_agent`) to your local `pretix.cfg` file for testing the geocoding feature.
|
147
|
+
7. Restart your local pretix server and Celery worker. You can now use the plugin from this repository for your events by enabling it in the 'plugins' tab in the settings.
|
148
|
+
|
149
|
+
This plugin has CI set up to enforce a few code style rules. To check locally, you need these packages installed::
|
150
|
+
|
151
|
+
pip install flake8 isort black
|
152
|
+
|
153
|
+
To check your plugin for rule violations, run::
|
154
|
+
|
155
|
+
black --check .
|
156
|
+
isort -c .
|
157
|
+
flake8 .
|
158
|
+
|
159
|
+
You can auto-fix some of these issues by running::
|
160
|
+
|
161
|
+
isort .
|
162
|
+
black .
|
163
|
+
|
164
|
+
To automatically check for these issues before you commit, you can run ``.install-hooks``.
|
165
|
+
|
166
|
+
|
167
|
+
License
|
168
|
+
-------
|
169
|
+
|
170
|
+
Copyright 2025 MarkenJaden
|
171
|
+
|
172
|
+
Released under the terms of the Apache License 2.0
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
.. _pretix: https://github.com/pretix/pretix
|
177
|
+
.. _pretix installation: https://docs.pretix.eu/en/latest/administrator/installation/index.html
|
178
|
+
.. _pretix development setup: https://docs.pretix.eu/en/latest/development/setup.html
|
@@ -0,0 +1,193 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: pretix-map
|
3
|
+
Version: 0.0.3
|
4
|
+
Summary: An overview map of the catchment area of previous orders. Measured by postcode
|
5
|
+
Author-email: MarkenJaden <jjsch1410@gmail.com>
|
6
|
+
Maintainer-email: MarkenJaden <jjsch1410@gmail.com>
|
7
|
+
License: Apache
|
8
|
+
Project-URL: homepage, https://github.com/MarkenJaden/pretix-map
|
9
|
+
Project-URL: repository, https://github.com/MarkenJaden/pretix-map
|
10
|
+
Keywords: pretix
|
11
|
+
Description-Content-Type: text/x-rst
|
12
|
+
License-File: LICENSE
|
13
|
+
Requires-Dist: geopy
|
14
|
+
Dynamic: license-file
|
15
|
+
|
16
|
+
Map-Plugin
|
17
|
+
==========================
|
18
|
+
|
19
|
+
This is a plugin for `pretix`_.
|
20
|
+
|
21
|
+
It provides an overview map visualizing the geographic location of attendees based on the addresses provided in their orders. The plugin automatically geocodes order addresses upon payment and displays the locations on an interactive map within the event control panel.
|
22
|
+
|
23
|
+
Features:
|
24
|
+
|
25
|
+
* Automatic geocoding of paid order addresses using a configured geocoding service.
|
26
|
+
* Interactive map display (Leaflet) showing locations as clustered pins or a heatmap.
|
27
|
+
* Option to toggle between pin view and heatmap view.
|
28
|
+
* Pins show tooltips with Order Code, Date, and Item Count on hover.
|
29
|
+
* Clicking a pin navigates directly to the corresponding order details page.
|
30
|
+
* Adds a "Sales Map" link to the event navigation sidebar.
|
31
|
+
* Includes a management command to geocode orders placed *before* the plugin was installed or configured.
|
32
|
+
|
33
|
+
Requirements
|
34
|
+
------------
|
35
|
+
|
36
|
+
* A working `pretix installation`_.
|
37
|
+
* A **Celery worker** configured and running for your Pretix instance. This is essential for the background geocoding tasks.
|
38
|
+
* Access to a **Geocoding Service**. This plugin requires configuration to use an external service to convert addresses to latitude/longitude coordinates. See the **Configuration** section below.
|
39
|
+
|
40
|
+
|
41
|
+
Installation (Production)
|
42
|
+
--------------------------
|
43
|
+
|
44
|
+
1. Ensure you meet the requirements above, especially a running Celery worker.
|
45
|
+
2. Activate the virtual environment used for your Pretix installation.
|
46
|
+
3. Install the plugin via pip:
|
47
|
+
|
48
|
+
.. code-block:: bash
|
49
|
+
|
50
|
+
pip install pretix-map-plugin
|
51
|
+
|
52
|
+
*(Note: If the plugin is not on PyPI yet, you might need to install from the git repository URL)*
|
53
|
+
4. Configure the required geocoding service settings in your `pretix.cfg` file (see **Configuration** below).
|
54
|
+
5. Restart your Pretix webserver (`gunicorn`/`uwsgi`) **and** your Pretix Celery worker(s).
|
55
|
+
6. Log in to your Pretix backend and go to Organizer Settings -> Plugins. Enable the "Sales Map" plugin for the desired organizer(s).
|
56
|
+
7. Go into an event, then navigate to Event Settings -> Plugins and ensure the "Sales Map" plugin is checked (enabled) for that event.
|
57
|
+
|
58
|
+
|
59
|
+
Configuration (`pretix.cfg`)
|
60
|
+
------------------------------
|
61
|
+
|
62
|
+
This plugin requires configuration in your `pretix.cfg` file to specify which geocoding service to use. Add a section `[pretix_mapplugin]` if it doesn't exist.
|
63
|
+
|
64
|
+
**Required Setting (Choose ONE method):**
|
65
|
+
|
66
|
+
* **Method 1: Nominatim (OpenStreetMap - Free, Requires User-Agent)**
|
67
|
+
Nominatim is a free geocoding service based on OpenStreetMap data. It has usage policies that **require** you to set a descriptive User-Agent header, typically including your application name and contact email. Failure to do so may result in your IP being blocked.
|
68
|
+
|
69
|
+
.. code-block:: ini
|
70
|
+
|
71
|
+
[pretix_mapplugin]
|
72
|
+
# REQUIRED for Nominatim: Set a descriptive User-Agent including application name and contact info.
|
73
|
+
# Replace with your actual details! See: https://operations.osmfoundation.org/policies/nominatim/
|
74
|
+
nominatim_user_agent=YourTicketingSite/1.0 (Contact: admin@yourdomain.com) pretix-map-plugin/1.0
|
75
|
+
|
76
|
+
* **Method 2: Other Geocoding Services (e.g., Google, Mapbox - API Key likely needed)**
|
77
|
+
*(This example assumes you have modified `tasks.py` to use a different geocoder like GeoPy with GoogleV3. Adjust the setting name and value based on your implementation.)*
|
78
|
+
|
79
|
+
.. code-block:: ini
|
80
|
+
|
81
|
+
[pretix_mapplugin]
|
82
|
+
# Example for Google Geocoding API (if implemented in tasks.py)
|
83
|
+
# google_geocoding_api_key=YOUR_GOOGLE_GEOCODING_API_KEY
|
84
|
+
|
85
|
+
**Important:** After adding or changing settings in `pretix.cfg`, you **must restart** the Pretix webserver and Celery workers for the changes to take effect.
|
86
|
+
|
87
|
+
Usage
|
88
|
+
-----
|
89
|
+
|
90
|
+
1. Once installed, configured, and enabled, the plugin works mostly automatically.
|
91
|
+
2. When an order is marked as paid, a background task is queued to geocode the address associated with the order (typically the invoice address). This requires your Celery worker to be running.
|
92
|
+
3. A "Sales Map" link will appear in the event control panel's sidebar navigation (usually near other order-related items or plugin links) for users with the "Can view orders" permission.
|
93
|
+
4. Clicking this link displays the map. You can toggle between the pin view (markers clustered) and the heatmap view using the button provided.
|
94
|
+
5. In the pin view:
|
95
|
+
|
96
|
+
* Hover over a marker cluster to see the number of orders it represents.
|
97
|
+
* Zoom in to break clusters apart.
|
98
|
+
* Hover over an individual pin to see a tooltip with Order Code, Date, and Item Count.
|
99
|
+
* Click an individual pin to open the corresponding order details page in a new tab.
|
100
|
+
|
101
|
+
Management Command: `geocode_existing_orders`
|
102
|
+
---------------------------------------------
|
103
|
+
|
104
|
+
This command is essential for processing orders that were placed *before* the map plugin was installed, enabled, or correctly configured with geocoding credentials. It scans paid orders and queues geocoding tasks for those that haven't been geocoded yet.
|
105
|
+
|
106
|
+
**When to Run:**
|
107
|
+
|
108
|
+
* After installing and configuring the plugin for the first time.
|
109
|
+
* If you previously ran the plugin without a working geocoding configuration or Celery worker.
|
110
|
+
* If you want to force-reprocess orders (e.g., if geocoding logic changed).
|
111
|
+
|
112
|
+
**Prerequisites:**
|
113
|
+
|
114
|
+
* Your Pretix Celery worker **must** be running to process the tasks queued by this command.
|
115
|
+
* Geocoding settings must be correctly configured in `pretix.cfg`.
|
116
|
+
|
117
|
+
**How to Run:**
|
118
|
+
|
119
|
+
1. Navigate to your Pretix installation directory (containing `manage.py`) in your server terminal.
|
120
|
+
2. Activate your Pretix virtual environment.
|
121
|
+
3. Execute the command using `manage.py`.
|
122
|
+
|
123
|
+
**Basic Command:**
|
124
|
+
|
125
|
+
.. code-block:: bash
|
126
|
+
|
127
|
+
python manage.py geocode_existing_orders [options]
|
128
|
+
|
129
|
+
**Available Options:**
|
130
|
+
|
131
|
+
* `--organizer <slug>`: Process orders only for the organizer with the given slug.
|
132
|
+
* Example: `python manage.py geocode_existing_orders --organizer=myorg`
|
133
|
+
* `--event <slug>`: Process orders only for the event with the given slug. **Requires** `--organizer` to be specified as well.
|
134
|
+
* Example: `python manage.py geocode_existing_orders --organizer=myorg --event=myevent2024`
|
135
|
+
* `--dry-run`: **Highly Recommended for first use!** Simulates the process and shows which orders *would* be queued, but doesn't actually queue any tasks. Use this to verify the scope and count before running for real.
|
136
|
+
* Example: `python manage.py geocode_existing_orders --dry-run`
|
137
|
+
* `--force-recode`: Queues geocoding tasks even for orders that already have an entry in the geocoding data table. Use this if you suspect previous geocoding attempts were incomplete or incorrect, or if the geocoding logic has been updated.
|
138
|
+
* Example: `python manage.py geocode_existing_orders --organizer=myorg --force-recode`
|
139
|
+
|
140
|
+
**Example Workflow:**
|
141
|
+
|
142
|
+
1. **Test with Dry Run (All Organizers):**
|
143
|
+
.. code-block:: bash
|
144
|
+
|
145
|
+
python manage.py geocode_existing_orders --dry-run
|
146
|
+
2. **(If satisfied) Run for Real (All Organizers):**
|
147
|
+
.. code-block:: bash
|
148
|
+
|
149
|
+
python manage.py geocode_existing_orders
|
150
|
+
3. **Monitor your Celery worker** logs to ensure tasks are being processed without errors.
|
151
|
+
|
152
|
+
|
153
|
+
Development setup
|
154
|
+
-----------------
|
155
|
+
|
156
|
+
1. Make sure that you have a working `pretix development setup`_. Ensure your dev setup includes a running Celery worker if you want to test the background tasks.
|
157
|
+
2. Clone this repository.
|
158
|
+
3. Activate the virtual environment you use for pretix development.
|
159
|
+
4. Execute ``python setup.py develop`` within this directory to register this application with pretix's plugin registry.
|
160
|
+
5. Execute ``make`` within this directory to compile translations.
|
161
|
+
6. **Configure Geocoding:** Add the necessary geocoding settings (e.g., `nominatim_user_agent`) to your local `pretix.cfg` file for testing the geocoding feature.
|
162
|
+
7. Restart your local pretix server and Celery worker. You can now use the plugin from this repository for your events by enabling it in the 'plugins' tab in the settings.
|
163
|
+
|
164
|
+
This plugin has CI set up to enforce a few code style rules. To check locally, you need these packages installed::
|
165
|
+
|
166
|
+
pip install flake8 isort black
|
167
|
+
|
168
|
+
To check your plugin for rule violations, run::
|
169
|
+
|
170
|
+
black --check .
|
171
|
+
isort -c .
|
172
|
+
flake8 .
|
173
|
+
|
174
|
+
You can auto-fix some of these issues by running::
|
175
|
+
|
176
|
+
isort .
|
177
|
+
black .
|
178
|
+
|
179
|
+
To automatically check for these issues before you commit, you can run ``.install-hooks``.
|
180
|
+
|
181
|
+
|
182
|
+
License
|
183
|
+
-------
|
184
|
+
|
185
|
+
Copyright 2025 MarkenJaden
|
186
|
+
|
187
|
+
Released under the terms of the Apache License 2.0
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
.. _pretix: https://github.com/pretix/pretix
|
192
|
+
.. _pretix installation: https://docs.pretix.eu/en/latest/administrator/installation/index.html
|
193
|
+
.. _pretix development setup: https://docs.pretix.eu/en/latest/development/setup.html
|
@@ -0,0 +1,52 @@
|
|
1
|
+
LICENSE
|
2
|
+
MANIFEST.in
|
3
|
+
README.rst
|
4
|
+
pyproject.toml
|
5
|
+
setup.cfg
|
6
|
+
setup.py
|
7
|
+
pretix_map.egg-info/PKG-INFO
|
8
|
+
pretix_map.egg-info/SOURCES.txt
|
9
|
+
pretix_map.egg-info/dependency_links.txt
|
10
|
+
pretix_map.egg-info/entry_points.txt
|
11
|
+
pretix_map.egg-info/requires.txt
|
12
|
+
pretix_map.egg-info/top_level.txt
|
13
|
+
pretix_mapplugin/__init__.py
|
14
|
+
pretix_mapplugin/apps.py
|
15
|
+
pretix_mapplugin/geocoding.py
|
16
|
+
pretix_mapplugin/models.py
|
17
|
+
pretix_mapplugin/signals.py
|
18
|
+
pretix_mapplugin/tasks.py
|
19
|
+
pretix_mapplugin/urls.py
|
20
|
+
pretix_mapplugin/views.py
|
21
|
+
pretix_mapplugin/locale/de/LC_MESSAGES/django.mo
|
22
|
+
pretix_mapplugin/locale/de/LC_MESSAGES/django.po
|
23
|
+
pretix_mapplugin/locale/de_Informal/.gitkeep
|
24
|
+
pretix_mapplugin/locale/de_Informal/LC_MESSAGES/django.mo
|
25
|
+
pretix_mapplugin/locale/de_Informal/LC_MESSAGES/django.po
|
26
|
+
pretix_mapplugin/management/__init__.py
|
27
|
+
pretix_mapplugin/management/commands/__init__.py
|
28
|
+
pretix_mapplugin/management/commands/geocode_existing_orders.py
|
29
|
+
pretix_mapplugin/migrations/__init__.py
|
30
|
+
pretix_mapplugin/static/pretix_mapplugin/.gitkeep
|
31
|
+
pretix_mapplugin/static/pretix_mapplugin/css/salesmap.css
|
32
|
+
pretix_mapplugin/static/pretix_mapplugin/js/salesmap.js
|
33
|
+
pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/MarkerCluster.Default.css
|
34
|
+
pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/MarkerCluster.css
|
35
|
+
pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet-heat.js
|
36
|
+
pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet-src.esm.js
|
37
|
+
pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet-src.esm.js.map
|
38
|
+
pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet-src.js
|
39
|
+
pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet-src.js.map
|
40
|
+
pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet.css
|
41
|
+
pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet.js
|
42
|
+
pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet.js.map
|
43
|
+
pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet.markercluster.js
|
44
|
+
pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/leaflet.markercluster.js.map
|
45
|
+
pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/images/layers-2x.png
|
46
|
+
pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/images/layers.png
|
47
|
+
pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/images/marker-icon-2x.png
|
48
|
+
pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/images/marker-icon.png
|
49
|
+
pretix_mapplugin/static/pretix_mapplugin/libs/leaflet-sales-map/images/marker-shadow.png
|
50
|
+
pretix_mapplugin/templates/pretix_mapplugin/.gitkeep
|
51
|
+
pretix_mapplugin/templates/pretix_mapplugin/map_page.html
|
52
|
+
tests/test_main.py
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
geopy
|
@@ -0,0 +1 @@
|
|
1
|
+
pretix_mapplugin
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.0.3"
|