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.
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,4 @@
1
+ from .orders_data import export_orders_to_csv
2
+
3
+ __version__ = "0.1.0"
4
+ __all__ = ["export_orders_to_csv"]
@@ -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,3 @@
1
+ django>=4.0.0
2
+ Pillow>=10.0.0
3
+ reportlab>=4.4.5
@@ -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
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+