export-orders-lib 0.1.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.
- export_orders_lib-0.1.0/LICENSE +0 -0
- export_orders_lib-0.1.0/MANIFEST.in +0 -0
- export_orders_lib-0.1.0/PKG-INFO +21 -0
- export_orders_lib-0.1.0/README.md +0 -0
- export_orders_lib-0.1.0/export_orders_lib/__init__.py +4 -0
- export_orders_lib-0.1.0/export_orders_lib/orders_data.py +44 -0
- export_orders_lib-0.1.0/export_orders_lib.egg-info/PKG-INFO +21 -0
- export_orders_lib-0.1.0/export_orders_lib.egg-info/SOURCES.txt +11 -0
- export_orders_lib-0.1.0/export_orders_lib.egg-info/dependency_links.txt +1 -0
- export_orders_lib-0.1.0/export_orders_lib.egg-info/requires.txt +3 -0
- export_orders_lib-0.1.0/export_orders_lib.egg-info/top_level.txt +1 -0
- export_orders_lib-0.1.0/pyproject.toml +30 -0
- export_orders_lib-0.1.0/setup.cfg +4 -0
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: export_orders_lib
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python library for exporting orders data to csv file
|
|
5
|
+
Author-email: Yashaswini <x24262404@student.ncirl.ie>
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: orders,data,export
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Education
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: Microsoft :: Windows :: Windows 10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Requires-Python: >=3.6
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: django>=4.0.0
|
|
19
|
+
Requires-Dist: Pillow>=10.0.0
|
|
20
|
+
Requires-Dist: reportlab>=4.4.5
|
|
21
|
+
Dynamic: license-file
|
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import csv
|
|
2
|
+
from django.http import HttpResponse
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def export_orders_to_csv(queryset, filename="orders_data.csv"):
|
|
6
|
+
"""
|
|
7
|
+
Generic reusable CSV exporter for Django Orders queryset.
|
|
8
|
+
Expects queryset with:
|
|
9
|
+
- product
|
|
10
|
+
- customer
|
|
11
|
+
- customer.user
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
response = HttpResponse(content_type="text/csv")
|
|
15
|
+
response["Content-Disposition"] = f'attachment; filename="{filename}"'
|
|
16
|
+
|
|
17
|
+
writer = csv.writer(response)
|
|
18
|
+
|
|
19
|
+
writer.writerow([
|
|
20
|
+
"Order ID",
|
|
21
|
+
"Product Name",
|
|
22
|
+
"Product Price",
|
|
23
|
+
"Customer Name",
|
|
24
|
+
"Customer Email",
|
|
25
|
+
"Mobile",
|
|
26
|
+
"Address",
|
|
27
|
+
"Order Date",
|
|
28
|
+
"Status",
|
|
29
|
+
])
|
|
30
|
+
|
|
31
|
+
for order in queryset:
|
|
32
|
+
writer.writerow([
|
|
33
|
+
getattr(order, "id", ""),
|
|
34
|
+
getattr(order.product, "name", "") if order.product else "",
|
|
35
|
+
getattr(order.product, "price", "") if order.product else "",
|
|
36
|
+
getattr(order.customer, "get_name", "") if order.customer else "",
|
|
37
|
+
getattr(order.customer.user, "email", "") if order.customer and order.customer.user else "",
|
|
38
|
+
getattr(order, "mobile", ""),
|
|
39
|
+
getattr(order, "address", ""),
|
|
40
|
+
getattr(order, "order_date", ""),
|
|
41
|
+
getattr(order, "status", ""),
|
|
42
|
+
])
|
|
43
|
+
|
|
44
|
+
return response
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: export_orders_lib
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python library for exporting orders data to csv file
|
|
5
|
+
Author-email: Yashaswini <x24262404@student.ncirl.ie>
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: orders,data,export
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Education
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: Microsoft :: Windows :: Windows 10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Requires-Python: >=3.6
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: django>=4.0.0
|
|
19
|
+
Requires-Dist: Pillow>=10.0.0
|
|
20
|
+
Requires-Dist: reportlab>=4.4.5
|
|
21
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
export_orders_lib/__init__.py
|
|
6
|
+
export_orders_lib/orders_data.py
|
|
7
|
+
export_orders_lib.egg-info/PKG-INFO
|
|
8
|
+
export_orders_lib.egg-info/SOURCES.txt
|
|
9
|
+
export_orders_lib.egg-info/dependency_links.txt
|
|
10
|
+
export_orders_lib.egg-info/requires.txt
|
|
11
|
+
export_orders_lib.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export_orders_lib
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
[build-system]
|
|
3
|
+
requires = ["setuptools>=61.0.0", "wheel"]
|
|
4
|
+
build-backend = "setuptools.build_meta"
|
|
5
|
+
|
|
6
|
+
[project]
|
|
7
|
+
name = "export_orders_lib"
|
|
8
|
+
version = "0.1.0"
|
|
9
|
+
description = "A Python library for exporting orders data to csv file"
|
|
10
|
+
readme = {file = "README.md", content-type = "text/markdown"}
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "Yashaswini", email = "x24262404@student.ncirl.ie"}
|
|
13
|
+
]
|
|
14
|
+
license = {text = "MIT"}
|
|
15
|
+
keywords = ["orders","data","export"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Education",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Operating System :: Microsoft :: Windows :: Windows 10",
|
|
21
|
+
"Programming Language :: Python :: 3.9",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
]
|
|
25
|
+
requires-python = ">=3.6"
|
|
26
|
+
dependencies = [
|
|
27
|
+
"django>=4.0.0",
|
|
28
|
+
"Pillow>=10.0.0",
|
|
29
|
+
"reportlab>=4.4.5"
|
|
30
|
+
]
|