django-npdatetime 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.
Files changed (42) hide show
  1. django_npdatetime-0.1.0/.gitignore +18 -0
  2. django_npdatetime-0.1.0/CHANGELOG.md +38 -0
  3. django_npdatetime-0.1.0/DEVELOPER.md +251 -0
  4. django_npdatetime-0.1.0/LICENSE +21 -0
  5. django_npdatetime-0.1.0/MANIFEST.in +6 -0
  6. django_npdatetime-0.1.0/PKG-INFO +397 -0
  7. django_npdatetime-0.1.0/QUICKSTART.md +119 -0
  8. django_npdatetime-0.1.0/README.md +357 -0
  9. django_npdatetime-0.1.0/WORKFLOW.md +70 -0
  10. django_npdatetime-0.1.0/build_assets.py +66 -0
  11. django_npdatetime-0.1.0/build_assets.sh +42 -0
  12. django_npdatetime-0.1.0/django_npdatetime.egg-info/PKG-INFO +397 -0
  13. django_npdatetime-0.1.0/django_npdatetime.egg-info/SOURCES.txt +40 -0
  14. django_npdatetime-0.1.0/django_npdatetime.egg-info/dependency_links.txt +1 -0
  15. django_npdatetime-0.1.0/django_npdatetime.egg-info/requires.txt +2 -0
  16. django_npdatetime-0.1.0/django_npdatetime.egg-info/top_level.txt +1 -0
  17. django_npdatetime-0.1.0/example/README.md +82 -0
  18. django_npdatetime-0.1.0/example/__init__.py +3 -0
  19. django_npdatetime-0.1.0/example/admin.py +34 -0
  20. django_npdatetime-0.1.0/example/forms.py +77 -0
  21. django_npdatetime-0.1.0/example/models.py +48 -0
  22. django_npdatetime-0.1.0/npdatetime_django/__init__.py +22 -0
  23. django_npdatetime-0.1.0/npdatetime_django/apps.py +13 -0
  24. django_npdatetime-0.1.0/npdatetime_django/forms.py +239 -0
  25. django_npdatetime-0.1.0/npdatetime_django/models.py +198 -0
  26. django_npdatetime-0.1.0/npdatetime_django/static/npdatetime_django/css/date_picker.css +746 -0
  27. django_npdatetime-0.1.0/npdatetime_django/static/npdatetime_django/js/date_picker.min.js +1381 -0
  28. django_npdatetime-0.1.0/npdatetime_django/static/npdatetime_django/js/pkg/README.md +345 -0
  29. django_npdatetime-0.1.0/npdatetime_django/static/npdatetime_django/js/pkg/npdatetime_wasm.d.ts +205 -0
  30. django_npdatetime-0.1.0/npdatetime_django/static/npdatetime_django/js/pkg/npdatetime_wasm.js +813 -0
  31. django_npdatetime-0.1.0/npdatetime_django/static/npdatetime_django/js/pkg/npdatetime_wasm_bg.wasm +0 -0
  32. django_npdatetime-0.1.0/npdatetime_django/static/npdatetime_django/js/pkg/npdatetime_wasm_bg.wasm.d.ts +36 -0
  33. django_npdatetime-0.1.0/npdatetime_django/static/npdatetime_django/js/pkg/package.json +15 -0
  34. django_npdatetime-0.1.0/npdatetime_django/templates/npdatetime_django/widgets/date_picker.html +28 -0
  35. django_npdatetime-0.1.0/npdatetime_django/templates/npdatetime_django/widgets/date_range.html +25 -0
  36. django_npdatetime-0.1.0/npdatetime_django/templatetags/__init__.py +259 -0
  37. django_npdatetime-0.1.0/npdatetime_django/templatetags/nepali_date.py +1 -0
  38. django_npdatetime-0.1.0/npdatetime_django/utils.py +131 -0
  39. django_npdatetime-0.1.0/npdatetime_django/widgets.py +168 -0
  40. django_npdatetime-0.1.0/pyproject.toml +54 -0
  41. django_npdatetime-0.1.0/setup.cfg +4 -0
  42. django_npdatetime-0.1.0/setup.py +55 -0
@@ -0,0 +1,18 @@
1
+ # Django package build artifacts
2
+ build/
3
+ dist/
4
+ *.egg-info/
5
+ __pycache__/
6
+ *.pyc
7
+ *.pyo
8
+
9
+ # Local development
10
+ .venv/
11
+ env/
12
+ venv/
13
+ .env
14
+
15
+ # JavaScript build artifacts (copied via sync)
16
+ npdatetime_django/static/npdatetime_django/js/pkg/
17
+ npdatetime_django/static/npdatetime_django/js/date_picker.min.js
18
+ npdatetime_django/static/npdatetime_django/css/date_picker.css
@@ -0,0 +1,38 @@
1
+ # Changelog
2
+
3
+ All notable changes to django-npdatetime will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] - 2026-02-04
11
+
12
+ ### Added
13
+ - Initial release of django-npdatetime
14
+ - Custom model fields:
15
+ - `NepaliDateField` for storing Nepali dates
16
+ - `NepaliDateTimeField` for storing Nepali dates with time
17
+ - Custom form fields:
18
+ - `NepaliDateField` with validation
19
+ - `NepaliDateTimeField` with validation
20
+ - `NepaliDateRangeField` for date ranges
21
+ - Custom widgets:
22
+ - `NepaliDatePickerWidget` with rich features
23
+ - `NepaliDateRangeWidget` for selecting date ranges
24
+ - Template tags and filters:
25
+ - `to_nepali_date` - Convert Gregorian to Nepali
26
+ - `to_gregorian_date` - Convert Nepali to Gregorian
27
+ - `format_nepali_date` - Format Nepali dates
28
+ - `nepali_month_name` - Get month names
29
+ - `to_nepali_number` - Convert to Nepali numerals
30
+ - `nepali_date_today` - Get today's Nepali date
31
+ - Utility functions for date conversion and validation
32
+ - Django admin integration
33
+ - Bilingual support (English and Nepali)
34
+ - Multiple theme support (auto, light, dark)
35
+ - Comprehensive documentation and examples
36
+
37
+ [Unreleased]: https://github.com/4mritGiri/npdatetime-rust/compare/v0.1.0...HEAD
38
+ [0.1.0]: https://github.com/4mritGiri/npdatetime-rust/releases/tag/v0.1.0
@@ -0,0 +1,251 @@
1
+ # Developer Guide - Django NPDateTime
2
+
3
+ ## For Package Maintainers
4
+
5
+ ### Project Structure
6
+
7
+ The Django package lives in `bindings/django/` but depends on assets from `bindings/javascript/`:
8
+
9
+ ```
10
+ npdatetime-rust/
11
+ ├── bindings/
12
+ │ ├── javascript/ # Source of truth for UI
13
+ │ │ ├── date_picker.js # Main date picker
14
+ │ │ ├── date_picker.css # Styles
15
+ │ │ └── pkg/ # WASM bindings
16
+ │ │
17
+ │ └── django/ # Django package
18
+ │ ├── build_assets.py # Asset sync script ⭐
19
+ │ ├── npdatetime_django/
20
+ │ │ └── static/npdatetime_django/
21
+ │ │ ├── js/
22
+ │ │ │ ├── date_picker.min.js # Copied from ../javascript/
23
+ │ │ │ └── pkg/ # Copied from ../javascript/
24
+ │ │ └── css/
25
+ │ │ └── date_picker.css # Copied from ../javascript/
26
+ ```
27
+
28
+ ## Important: Single Source of Truth
29
+
30
+ **DO NOT edit files in `npdatetime_django/static/` directly!**
31
+
32
+ These files are **copied** from `bindings/javascript/`. If you edit them directly, your changes will be overwritten.
33
+
34
+ ### Workflow When Updating JavaScript/CSS
35
+
36
+ 1. **Edit the source files** in `bindings/javascript/`:
37
+ - `date_picker.js`
38
+ - `date_picker.css`
39
+
40
+ 2. **Run the build script** to sync to Django:
41
+ ```bash
42
+ cd bindings/django
43
+ python3 build_assets.py
44
+ # or
45
+ ./build_assets.sh
46
+ ```
47
+
48
+ 3. **Test the Django package**:
49
+ ```bash
50
+ pip install -e . # Install in development mode
51
+ # Test in a Django project
52
+ ```
53
+
54
+ 4. **Commit both locations** if needed:
55
+ ```bash
56
+ git add bindings/javascript/date_picker.js
57
+ git add bindings/django/npdatetime_django/static/npdatetime_django/js/date_picker.min.js
58
+ git commit -m "Update date picker UI"
59
+ ```
60
+
61
+ ## Build Assets Script
62
+
63
+ ### What It Does
64
+
65
+ The `build_assets.py` script:
66
+ - Copies `date_picker.js` → `static/npdatetime_django/js/date_picker.min.js`
67
+ - Copies `date_picker.css` → `static/npdatetime_django/css/date_picker.css`
68
+ - Copies `pkg/` directory → `static/npdatetime_django/js/pkg/`
69
+
70
+ ### When to Run It
71
+
72
+ Run the build script whenever you:
73
+ - Update the JavaScript date picker code
74
+ - Update the CSS styles
75
+ - Rebuild the WASM bindings
76
+ - Before publishing a new version
77
+
78
+ ### Usage
79
+
80
+ ```bash
81
+ # Python version (cross-platform)
82
+ python3 build_assets.py
83
+
84
+ # Bash version (Linux/Mac)
85
+ ./build_assets.sh
86
+ ```
87
+
88
+ ## Development Setup
89
+
90
+ ### 1. Install the Package in Development Mode
91
+
92
+ ```bash
93
+ cd bindings/django
94
+ pip install -e .
95
+ ```
96
+
97
+ This creates a symlink so changes are reflected immediately.
98
+
99
+ ### 2. Create a Test Django Project
100
+
101
+ ```bash
102
+ django-admin startproject testproject
103
+ cd testproject
104
+
105
+ # Add to settings.py
106
+ INSTALLED_APPS = [
107
+ ...
108
+ 'npdatetime_django',
109
+ ]
110
+
111
+ # Create test app
112
+ python manage.py startapp testapp
113
+ ```
114
+
115
+ ### 3. Test the Package
116
+
117
+ Create test models, forms, and views using the package components.
118
+
119
+ ## Publishing Workflow
120
+
121
+ ### 1. Update Version
122
+
123
+ Update version in:
124
+ - `setup.py`
125
+ - `pyproject.toml`
126
+ - `npdatetime_django/__init__.py`
127
+ - `CHANGELOG.md`
128
+
129
+ ### 2. Build Assets
130
+
131
+ ```bash
132
+ python3 build_assets.py
133
+ ```
134
+
135
+ ### 3. Build Package
136
+
137
+ ```bash
138
+ python setup.py sdist bdist_wheel
139
+ ```
140
+
141
+ ### 4. Test on TestPyPI (Optional)
142
+
143
+ ```bash
144
+ pip install twine
145
+ twine upload --repository testpypi dist/*
146
+ ```
147
+
148
+ ### 5. Publish to PyPI
149
+
150
+ ```bash
151
+ twine upload dist/*
152
+ ```
153
+
154
+ ## Common Tasks
155
+
156
+ ### Update JavaScript Only
157
+
158
+ ```bash
159
+ # 1. Edit bindings/javascript/date_picker.js
160
+ # 2. Run build script
161
+ cd bindings/django
162
+ python3 build_assets.py
163
+ ```
164
+
165
+ ### Update WASM Bindings
166
+
167
+ ```bash
168
+ # 1. Rebuild WASM
169
+ cd bindings/javascript
170
+ wasm-pack build
171
+
172
+ # 2. Sync to Django
173
+ cd ../django
174
+ python3 build_assets.py
175
+ ```
176
+
177
+ ### Update CSS Styles
178
+
179
+ ```bash
180
+ # 1. Edit bindings/javascript/date_picker.css
181
+ # 2. Run build script
182
+ cd bindings/django
183
+ python3 build_assets.py
184
+ ```
185
+
186
+ ## Testing Checklist
187
+
188
+ Before publishing a new version:
189
+
190
+ - [ ] Run `build_assets.py` to sync latest changes
191
+ - [ ] Test in a fresh Django project
192
+ - [ ] Test model fields (create, read, update, delete)
193
+ - [ ] Test form widgets in regular forms
194
+ - [ ] Test form widgets in Django admin
195
+ - [ ] Test all template tags and filters
196
+ - [ ] Test BS ↔ AD conversion
197
+ - [ ] Test both English and Nepali languages
198
+ - [ ] Test all three themes (auto, light, dark)
199
+ - [ ] Check that WASM files load correctly
200
+ - [ ] Verify static files are included in package
201
+ - [ ] Update CHANGELOG.md
202
+ - [ ] Tag release in git
203
+
204
+ ## File Organization
205
+
206
+ ### Python Files (Edit Freely)
207
+ - `npdatetime_django/__init__.py`
208
+ - `npdatetime_django/models.py`
209
+ - `npdatetime_django/forms.py`
210
+ - `npdatetime_django/widgets.py`
211
+ - `npdatetime_django/utils.py`
212
+ - `npdatetime_django/templatetags/nepali_date.py`
213
+
214
+ ### Template Files (Edit Freely)
215
+ - `npdatetime_django/templates/`
216
+
217
+ ### Static Files (DO NOT EDIT - Run build script)
218
+ - `npdatetime_django/static/` ← Copied from `../javascript/`
219
+
220
+ ### Configuration Files (Edit When Needed)
221
+ - `setup.py` - Package metadata
222
+ - `pyproject.toml` - Modern packaging config
223
+ - `MANIFEST.in` - Package data inclusion
224
+
225
+ ## Troubleshooting
226
+
227
+ ### Static Files Not Loading
228
+
229
+ 1. Check that `build_assets.py` ran successfully
230
+ 2. Verify files exist in `static/npdatetime_django/`
231
+ 3. Run `python manage.py collectstatic` in test project
232
+ 4. Check browser console for 404 errors
233
+
234
+ ### WASM Not Loading
235
+
236
+ 1. Ensure `pkg/` directory was copied
237
+ 2. Check WASM MIME type in web server config
238
+ 3. Verify CORS headers if serving from CDN
239
+
240
+ ### Changes Not Reflected
241
+
242
+ 1. Clear browser cache
243
+ 2. Restart Django development server
244
+ 3. Check that you ran `build_assets.py`
245
+ 4. Verify you're editing source files, not copies
246
+
247
+ ## Questions?
248
+
249
+ - Check the [main README](README.md)
250
+ - Review [example code](example/)
251
+ - Open an issue on GitHub
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Amrit Giri
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,6 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include npdatetime_django/static *
4
+ recursive-include npdatetime_django/templates *
5
+ recursive-exclude * __pycache__
6
+ recursive-exclude * *.py[co]