django-npdatetime 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,397 @@
1
+ Metadata-Version: 2.4
2
+ Name: django-npdatetime
3
+ Version: 0.1.0
4
+ Summary: Nepali Date Field and Date Picker Widget for Django
5
+ Home-page: https://github.com/4mritGiri/npdatetime-rust
6
+ Author: Amrit Giri
7
+ Author-email: Amrit Giri <4mritgiri@gmail.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/4mritGiri/npdatetime-rust
10
+ Project-URL: Documentation, https://github.com/4mritGiri/npdatetime-rust/tree/main/bindings/django
11
+ Project-URL: Repository, https://github.com/4mritGiri/npdatetime-rust.git
12
+ Project-URL: Bug Tracker, https://github.com/4mritGiri/npdatetime-rust/issues
13
+ Keywords: django,nepali,bikram sambat,date picker,calendar
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Web Environment
16
+ Classifier: Framework :: Django
17
+ Classifier: Framework :: Django :: 3.2
18
+ Classifier: Framework :: Django :: 4.0
19
+ Classifier: Framework :: Django :: 4.1
20
+ Classifier: Framework :: Django :: 4.2
21
+ Classifier: Framework :: Django :: 5.0
22
+ Classifier: Intended Audience :: Developers
23
+ Classifier: License :: OSI Approved :: MIT License
24
+ Classifier: Operating System :: OS Independent
25
+ Classifier: Programming Language :: Python :: 3
26
+ Classifier: Programming Language :: Python :: 3.8
27
+ Classifier: Programming Language :: Python :: 3.9
28
+ Classifier: Programming Language :: Python :: 3.10
29
+ Classifier: Programming Language :: Python :: 3.11
30
+ Classifier: Programming Language :: Python :: 3.12
31
+ Requires-Python: >=3.8
32
+ Description-Content-Type: text/markdown
33
+ License-File: LICENSE
34
+ Requires-Dist: Django>=3.2
35
+ Requires-Dist: npdatetime>=0.1.0
36
+ Dynamic: author
37
+ Dynamic: home-page
38
+ Dynamic: license-file
39
+ Dynamic: requires-python
40
+
41
+ # Django NPDateTime
42
+
43
+ **Nepali Date Field and Date Picker Widget for Django**
44
+
45
+ A Django package that provides custom model fields, form fields, and a modern date picker widget for working with Nepali (Bikram Sambat) dates. Powered by the high-performance [npdatetime-rust](https://github.com/4mritGiri/npdatetime-rust) library.
46
+
47
+ ## Features
48
+
49
+ ✨ **Custom Model Fields** - `NepaliDateField` and `NepaliDateTimeField` for storing Nepali dates in your database
50
+
51
+ 🎨 **Beautiful Date Picker Widget** - Modern, responsive date picker with both BS and AD modes
52
+
53
+ 🌐 **Bilingual Support** - English and Nepali language options
54
+
55
+ 🔄 **Auto Conversion** - Seamless conversion between Bikram Sambat and Gregorian calendars
56
+
57
+ 📝 **Template Tags & Filters** - Rich template tags for date formatting and conversion
58
+
59
+ ⚡ **High Performance** - Built on Rust for maximum speed
60
+
61
+ 🎯 **Django Integration** - Works seamlessly with Django's forms and admin
62
+
63
+ ## For Developers
64
+
65
+ If you're contributing to this package, the JavaScript/CSS files are synchronized from `../javascript/`. When you update the date picker:
66
+
67
+ ```bash
68
+ # Run the build script to sync assets
69
+ python build_assets.py
70
+ # or
71
+ ./build_assets.sh
72
+ ```
73
+
74
+ This copies:
75
+ - `date_picker.js` → `static/npdatetime_django/js/date_picker.min.js`
76
+ - `date_picker.css` → `static/npdatetime_django/css/date_picker.css`
77
+ - `pkg/` → `static/npdatetime_django/js/pkg/`
78
+
79
+ ## Installation
80
+
81
+ ```bash
82
+ pip install django-npdatetime
83
+ ```
84
+
85
+ ## Quick Start
86
+
87
+ ### 1. Add to INSTALLED_APPS
88
+
89
+ ```python
90
+ # settings.py
91
+ INSTALLED_APPS = [
92
+ ...
93
+ 'npdatetime_django',
94
+ ...
95
+ ]
96
+ ```
97
+
98
+ ### 2. Use in Models
99
+
100
+ ```python
101
+ from django.db import models
102
+ from npdatetime_django import NepaliDateField
103
+
104
+ class Person(models.Model):
105
+ name = models.CharField(max_length=100)
106
+ birth_date_bs = NepaliDateField()
107
+
108
+ def __str__(self):
109
+ return f"{self.name} - {self.birth_date_bs}"
110
+ ```
111
+
112
+ ### 3. Use in Forms
113
+
114
+ ```python
115
+ from django import forms
116
+ from npdatetime_django import NepaliDateField, NepaliDatePickerWidget
117
+
118
+ class PersonForm(forms.Form):
119
+ name = forms.CharField(max_length=100)
120
+ birth_date = NepaliDateField(
121
+ mode='BS',
122
+ language='np',
123
+ label='जन्म मिति'
124
+ )
125
+ ```
126
+
127
+ ### 4. Use Template Tags
128
+
129
+ ```django
130
+ {% load nepali_date %}
131
+
132
+ <p>Birth Date (BS): {{ person.birth_date_bs }}</p>
133
+ <p>Birth Date (AD): {{ person.birth_date_bs|to_gregorian_date }}</p>
134
+ <p>Today in BS: {% nepali_date_today %}</p>
135
+ <p>Month: {{ 1|nepali_month_name:"np" }}</p>
136
+ ```
137
+
138
+ ## Usage Guide
139
+
140
+ ### Model Fields
141
+
142
+ #### NepaliDateField
143
+
144
+ Stores Nepali dates in `YYYY-MM-DD` format.
145
+
146
+ ```python
147
+ from npdatetime_django.models import NepaliDateField
148
+
149
+ class Event(models.Model):
150
+ event_name = models.CharField(max_length=200)
151
+ event_date_bs = NepaliDateField()
152
+ ```
153
+
154
+ #### NepaliDateTimeField
155
+
156
+ Stores Nepali dates with time in `YYYY-MM-DD HH:MM:SS` format.
157
+
158
+ ```python
159
+ from npdatetime_django.models import NepaliDateTimeField
160
+
161
+ class Meeting(models.Model):
162
+ title = models.CharField(max_length=200)
163
+ scheduled_at_bs = NepaliDateTimeField()
164
+ ```
165
+
166
+ ### Form Fields and Widgets
167
+
168
+ #### Basic Date Picker
169
+
170
+ ```python
171
+ from npdatetime_django.forms import NepaliDateField
172
+
173
+ class PersonForm(forms.Form):
174
+ birth_date = NepaliDateField(
175
+ mode='BS', # 'BS' or 'AD'
176
+ language='en', # 'en' or 'np'
177
+ )
178
+ ```
179
+
180
+ #### Advanced Configuration
181
+
182
+ ```python
183
+ from npdatetime_django.widgets import NepaliDatePickerWidget
184
+
185
+ class EventForm(forms.Form):
186
+ event_date = forms.CharField(
187
+ widget=NepaliDatePickerWidget(
188
+ mode='BS',
189
+ language='np',
190
+ theme='dark',
191
+ show_today_button=True,
192
+ show_clear_button=True,
193
+ min_date='2080-01-01',
194
+ max_date='2085-12-30',
195
+ )
196
+ )
197
+ ```
198
+
199
+ #### Date Range Picker
200
+
201
+ ```python
202
+ from npdatetime_django.forms import NepaliDateRangeField
203
+
204
+ class ReportForm(forms.Form):
205
+ report_period = NepaliDateRangeField(
206
+ mode='BS',
207
+ language='np'
208
+ )
209
+
210
+ def clean_report_period(self):
211
+ period = self.cleaned_data['report_period']
212
+ start_date, end_date = period.split(' to ')
213
+ # Process date range
214
+ return period
215
+ ```
216
+
217
+ ### Template Tags and Filters
218
+
219
+ Load the template tag library:
220
+
221
+ ```django
222
+ {% load nepali_date %}
223
+ ```
224
+
225
+ #### Convert Gregorian to Nepali
226
+
227
+ ```django
228
+ {{ gregorian_date|to_nepali_date }}
229
+ {{ gregorian_date|to_nepali_date:"%Y/%m/%d" }}
230
+ ```
231
+
232
+ #### Convert Nepali to Gregorian
233
+
234
+ ```django
235
+ {{ nepali_date|to_gregorian_date }}
236
+ {{ nepali_date|to_gregorian_date:"%d/%m/%Y" }}
237
+ ```
238
+
239
+ #### Format Nepali Date
240
+
241
+ ```django
242
+ {{ "2081-01-15"|format_nepali_date:"%Y/%m/%d" }}
243
+ ```
244
+
245
+ #### Get Month Name
246
+
247
+ ```django
248
+ {{ 1|nepali_month_name }} {# Baisakh #}
249
+ {{ 1|nepali_month_name:"np" }} {# बैशाख #}
250
+ ```
251
+
252
+ #### Convert to Nepali Numerals
253
+
254
+ ```django
255
+ {{ 2081|to_nepali_number }} {# २०८१ #}
256
+ ```
257
+
258
+ #### Get Today's Date
259
+
260
+ ```django
261
+ {% nepali_date_today %}
262
+ {% nepali_date_today "%Y/%m/%d" %}
263
+ ```
264
+
265
+ ### Widget Options
266
+
267
+ The `NepaliDatePickerWidget` accepts the following options:
268
+
269
+ | Option | Type | Default | Description |
270
+ |--------|------|---------|-------------|
271
+ | `mode` | str | `'BS'` | Calendar mode: `'BS'` or `'AD'` |
272
+ | `language` | str | `'en'` | Interface language: `'en'` or `'np'` |
273
+ | `theme` | str | `'auto'` | Color theme: `'auto'`, `'light'`, or `'dark'` |
274
+ | `format` | str | `'%Y-%m-%d'` | Date format string |
275
+ | `include_time` | bool | `False` | Include time picker |
276
+ | `show_today_button` | bool | `True` | Show "Today" button |
277
+ | `show_clear_button` | bool | `True` | Show "Clear" button |
278
+ | `min_date` | str | `None` | Minimum selectable date |
279
+ | `max_date` | str | `None` | Maximum selectable date |
280
+
281
+ ## Admin Integration
282
+
283
+ The date picker automatically integrates with Django admin:
284
+
285
+ ```python
286
+ from django.contrib import admin
287
+ from .models import Person
288
+
289
+ @admin.register(Person)
290
+ class PersonAdmin(admin.ModelAdmin):
291
+ list_display = ['name', 'birth_date_bs']
292
+ fields = ['name', 'birth_date_bs']
293
+ ```
294
+
295
+ ## Examples
296
+
297
+ ### Complete Model Example
298
+
299
+ ```python
300
+ from django.db import models
301
+ from npdatetime_django.models import NepaliDateField, NepaliDateTimeField
302
+
303
+ class Employee(models.Model):
304
+ name = models.CharField(max_length=100)
305
+ join_date_bs = NepaliDateField(help_text="Joining date in BS")
306
+ birth_date_bs = NepaliDateField(blank=True, null=True)
307
+ last_login_bs = NepaliDateTimeField(blank=True, null=True)
308
+
309
+ class Meta:
310
+ ordering = ['-join_date_bs']
311
+
312
+ def __str__(self):
313
+ return f"{self.name} (Joined: {self.join_date_bs})"
314
+ ```
315
+
316
+ ### ModelForm Example
317
+
318
+ ```python
319
+ from django import forms
320
+ from .models import Employee
321
+
322
+ class EmployeeForm(forms.ModelForm):
323
+ class Meta:
324
+ model = Employee
325
+ fields = ['name', 'join_date_bs', 'birth_date_bs']
326
+ widgets = {
327
+ 'join_date_bs': NepaliDatePickerWidget(
328
+ mode='BS',
329
+ language='np',
330
+ theme='light'
331
+ ),
332
+ 'birth_date_bs': NepaliDatePickerWidget(
333
+ mode='BS',
334
+ language='np'
335
+ ),
336
+ }
337
+ ```
338
+
339
+ ### Template Example
340
+
341
+ ```django
342
+ {% load nepali_date %}
343
+ <!DOCTYPE html>
344
+ <html>
345
+ <head>
346
+ <title>Employee Details</title>
347
+ </head>
348
+ <body>
349
+ <h1>{{ employee.name }}</h1>
350
+
351
+ <div>
352
+ <strong>Join Date (BS):</strong>
353
+ {{ employee.join_date_bs|format_nepali_date:"%Y/%m/%d" }}
354
+ </div>
355
+
356
+ <div>
357
+ <strong>Join Date (AD):</strong>
358
+ {{ employee.join_date_bs|to_gregorian_date:"%B %d, %Y" }}
359
+ </div>
360
+
361
+ <div>
362
+ <strong>Birth Month:</strong>
363
+ {{ employee.birth_date_bs|slice:":7"|last|int|nepali_month_name:"np" }}
364
+ </div>
365
+ </body>
366
+ </html>
367
+ ```
368
+
369
+ ## Requirements
370
+
371
+ - Python >= 3.8
372
+ - Django >= 3.2
373
+ - npdatetime >= 0.1.0
374
+
375
+ ## Browser Support
376
+
377
+ - Chrome/Edge (latest)
378
+ - Firefox (latest)
379
+ - Safari (latest)
380
+ - Mobile browsers (iOS Safari, Chrome Mobile)
381
+
382
+ ## License
383
+
384
+ MIT License - see LICENSE file for details
385
+
386
+ ## Contributing
387
+
388
+ Contributions are welcome! Please feel free to submit a Pull Request.
389
+
390
+ ## Credits
391
+
392
+ Built on top of:
393
+ - [npdatetime-rust](https://github.com/4mritGiri/npdatetime-rust) - High-performance Nepali datetime library
394
+
395
+ ## Support
396
+
397
+ For bugs and feature requests, please open an issue on [GitHub](https://github.com/4mritGiri/npdatetime-rust/issues).
@@ -0,0 +1,23 @@
1
+ django_npdatetime-0.1.0.dist-info/licenses/LICENSE,sha256=gVuc3Mq5Di_4HysKLvqKlN9kI59DWllWt-iyKtoUxyo,1067
2
+ npdatetime_django/__init__.py,sha256=tMrLAMIyg4MertUr_L7dBXsRGr9lC-JbVAJNf7Khd08,600
3
+ npdatetime_django/apps.py,sha256=G00rkmxCLZU8LOZdHIhwUomReZn6LR-LsZsG6AK5wU8,402
4
+ npdatetime_django/forms.py,sha256=Z_Gd9we317io_4GxeHiiHU6Y7F21BFXKIPSqYMJzRz4,7434
5
+ npdatetime_django/models.py,sha256=dVtdN9dORk2ia2kFMkP1c_HPHbLXg0BkfZgenBRomlQ,6879
6
+ npdatetime_django/utils.py,sha256=DLhOu-VR8JMGbprM0jIfD8b-5rMRpux9Uzfy8Gb39Hk,3662
7
+ npdatetime_django/widgets.py,sha256=UnPn5GdOjPFBrIjZWH37AnIyIDOtGv1y7MDWG7Va5RU,5995
8
+ npdatetime_django/static/npdatetime_django/css/date_picker.css,sha256=0enCHAXGDJz3Ob_ANCuY5srsvMxW0qCfs-BOqnexPc4,15513
9
+ npdatetime_django/static/npdatetime_django/js/date_picker.min.js,sha256=cvHkuU_qDSyYAckJw69udgfsr8P0mHdvQUnV9dAXTDI,42410
10
+ npdatetime_django/static/npdatetime_django/js/pkg/README.md,sha256=o-6pRdtzXlmbBcTy9qKv9dV9H_EogHl0R1SHrsddpa8,8436
11
+ npdatetime_django/static/npdatetime_django/js/pkg/npdatetime_wasm.d.ts,sha256=R3n2IEm0gt2H1si12kizmRjz8Vsp8NRHNWcA9VvN3Z4,6895
12
+ npdatetime_django/static/npdatetime_django/js/pkg/npdatetime_wasm.js,sha256=kIdYF9UnPAtxttIvq2ugTc0mumEt0sokTYgnteU8Tg0,26967
13
+ npdatetime_django/static/npdatetime_django/js/pkg/npdatetime_wasm_bg.wasm,sha256=KqEmjA9ymYl25pD3CDVIO-kP8dF93cjugm_gUeS3-Mg,112951
14
+ npdatetime_django/static/npdatetime_django/js/pkg/npdatetime_wasm_bg.wasm.d.ts,sha256=DuUkIhYBz9DGjE5ensvtezVwc5tO4UkTEgeMeXCS_aU,2236
15
+ npdatetime_django/static/npdatetime_django/js/pkg/package.json,sha256=teJ3QvcNBDlwN4bOEeZrD1LGgDPL1EzO8OHcxnjdJps,285
16
+ npdatetime_django/templates/npdatetime_django/widgets/date_picker.html,sha256=PpeqlRwTKwFY9ZU8LmsojM49F2DdQ5ufeiIKF_t_n-w,823
17
+ npdatetime_django/templates/npdatetime_django/widgets/date_range.html,sha256=D7T4AZvm_MzKsU3Y_9Vi3wvcj-ykS0HZwcXKueQiIWQ,444
18
+ npdatetime_django/templatetags/__init__.py,sha256=Q3mdMm9fnjF4_J8r-MZN-rh_xUEuvBu1E9gZgP8gLqI,7185
19
+ npdatetime_django/templatetags/nepali_date.py,sha256=QxVZnMDkGMk5qZ3BMbxmG3zaUkFnhamoUN2YHv0ZT_Y,23
20
+ django_npdatetime-0.1.0.dist-info/METADATA,sha256=yCsEqofMG-8lhh_sPbaHZOCUs877dA36PMO1UqgEMZo,9958
21
+ django_npdatetime-0.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
22
+ django_npdatetime-0.1.0.dist-info/top_level.txt,sha256=rLaTmccDbdV7mqbq2Vexuw-LDuUy2giBrTCnSyoCKIM,18
23
+ django_npdatetime-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.10.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -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 @@
1
+ npdatetime_django
@@ -0,0 +1,22 @@
1
+ """
2
+ Django NPDateTime - Nepali Date Field and Picker for Django
3
+
4
+ A Django package that provides Nepali (Bikram Sambat) date field and
5
+ a modern, feature-rich date picker widget powered by npdatetime-rust.
6
+ """
7
+
8
+ __version__ = '0.1.0'
9
+ __author__ = 'Amrit Giri'
10
+ __email__ = 'amritgiri.dev@gmail.com'
11
+
12
+ default_app_config = 'npdatetime_django.apps.NpdatetimeDjangoConfig'
13
+
14
+ from .models import NepaliDateField
15
+ from .forms import NepaliDateField as NepaliDateFormField
16
+ from .widgets import NepaliDatePickerWidget
17
+
18
+ __all__ = [
19
+ 'NepaliDateField',
20
+ 'NepaliDateFormField',
21
+ 'NepaliDatePickerWidget',
22
+ ]
@@ -0,0 +1,13 @@
1
+ """Django app configuration for npdatetime_django"""
2
+ from django.apps import AppConfig
3
+
4
+
5
+ class NpdatetimeDjangoConfig(AppConfig):
6
+ """Configuration for the npdatetime_django app"""
7
+ default_auto_field = 'django.db.models.BigAutoField'
8
+ name = 'npdatetime_django'
9
+ verbose_name = 'Nepali DateTime for Django'
10
+
11
+ def ready(self):
12
+ """Called when the app is ready"""
13
+ pass