django-nepkit 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.
- django_nepkit/__init__.py +31 -0
- django_nepkit/admin.py +211 -0
- django_nepkit/forms.py +50 -0
- django_nepkit/models.py +269 -0
- django_nepkit/serializers.py +113 -0
- django_nepkit/static/django_nepkit/css/admin-nepali-datepicker.css +37 -0
- django_nepkit/static/django_nepkit/js/address-chaining.js +64 -0
- django_nepkit/static/django_nepkit/js/admin-jquery-bridge.js +10 -0
- django_nepkit/static/django_nepkit/js/nepali-datepicker-init.js +108 -0
- django_nepkit/templatetags/__init__.py +0 -0
- django_nepkit/templatetags/nepali.py +74 -0
- django_nepkit/urls.py +10 -0
- django_nepkit/utils.py +77 -0
- django_nepkit/validators.py +12 -0
- django_nepkit/views.py +22 -0
- django_nepkit/widgets.py +72 -0
- django_nepkit-0.1.0.dist-info/METADATA +377 -0
- django_nepkit-0.1.0.dist-info/RECORD +39 -0
- django_nepkit-0.1.0.dist-info/WHEEL +5 -0
- django_nepkit-0.1.0.dist-info/licenses/LICENSE +21 -0
- django_nepkit-0.1.0.dist-info/top_level.txt +2 -0
- example/demo/__init__.py +0 -0
- example/demo/admin.py +42 -0
- example/demo/apps.py +5 -0
- example/demo/migrations/0001_initial.py +2113 -0
- example/demo/migrations/0002_alter_person_phone_number.py +18 -0
- example/demo/migrations/0003_person_created_at_person_updated_at.py +27 -0
- example/demo/migrations/0004_alter_person_created_at_alter_person_updated_at.py +23 -0
- example/demo/migrations/0005_alter_person_created_at_alter_person_updated_at.py +27 -0
- example/demo/migrations/__init__.py +0 -0
- example/demo/models.py +27 -0
- example/demo/tests.py +1 -0
- example/demo/urls.py +9 -0
- example/demo/views.py +32 -0
- example/example_project/__init__.py +0 -0
- example/example_project/settings.py +76 -0
- example/example_project/urls.py +8 -0
- example/example_project/wsgi.py +7 -0
- example/manage.py +24 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Generated by Django 6.0.1 on 2026-01-28 15:37
|
|
2
|
+
|
|
3
|
+
import django_nepkit.models
|
|
4
|
+
from django.db import migrations
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
dependencies = [
|
|
9
|
+
("demo", "0001_initial"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AlterField(
|
|
14
|
+
model_name="person",
|
|
15
|
+
name="phone_number",
|
|
16
|
+
field=django_nepkit.models.NepaliPhoneNumberField(max_length=10),
|
|
17
|
+
),
|
|
18
|
+
]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Generated by Django 6.0.1 on 2026-01-28 15:38
|
|
2
|
+
|
|
3
|
+
import django.utils.timezone
|
|
4
|
+
import django_nepkit.models
|
|
5
|
+
from django.db import migrations
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Migration(migrations.Migration):
|
|
9
|
+
dependencies = [
|
|
10
|
+
("demo", "0002_alter_person_phone_number"),
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
operations = [
|
|
14
|
+
migrations.AddField(
|
|
15
|
+
model_name="person",
|
|
16
|
+
name="created_at",
|
|
17
|
+
field=django_nepkit.models.NepaliTimeField(
|
|
18
|
+
auto_now_add=True, default=django.utils.timezone.now
|
|
19
|
+
),
|
|
20
|
+
preserve_default=False,
|
|
21
|
+
),
|
|
22
|
+
migrations.AddField(
|
|
23
|
+
model_name="person",
|
|
24
|
+
name="updated_at",
|
|
25
|
+
field=django_nepkit.models.NepaliTimeField(auto_now=True),
|
|
26
|
+
),
|
|
27
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Generated by Django 6.0.1 on 2026-01-28 15:39
|
|
2
|
+
|
|
3
|
+
import django_nepkit.models
|
|
4
|
+
from django.db import migrations
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
dependencies = [
|
|
9
|
+
("demo", "0003_person_created_at_person_updated_at"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AlterField(
|
|
14
|
+
model_name="person",
|
|
15
|
+
name="created_at",
|
|
16
|
+
field=django_nepkit.models.NepaliDateField(auto_now_add=True),
|
|
17
|
+
),
|
|
18
|
+
migrations.AlterField(
|
|
19
|
+
model_name="person",
|
|
20
|
+
name="updated_at",
|
|
21
|
+
field=django_nepkit.models.NepaliDateField(auto_now=True),
|
|
22
|
+
),
|
|
23
|
+
]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Generated by Django 6.0.1 on 2026-01-28 16:55
|
|
2
|
+
|
|
3
|
+
import django_nepkit.models
|
|
4
|
+
from django.db import migrations
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
dependencies = [
|
|
9
|
+
("demo", "0004_alter_person_created_at_alter_person_updated_at"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AlterField(
|
|
14
|
+
model_name="person",
|
|
15
|
+
name="created_at",
|
|
16
|
+
field=django_nepkit.models.NepaliDateTimeField(
|
|
17
|
+
auto_now_add=True, blank=True, editable=False, max_length=19
|
|
18
|
+
),
|
|
19
|
+
),
|
|
20
|
+
migrations.AlterField(
|
|
21
|
+
model_name="person",
|
|
22
|
+
name="updated_at",
|
|
23
|
+
field=django_nepkit.models.NepaliDateTimeField(
|
|
24
|
+
auto_now=True, blank=True, editable=False, max_length=19
|
|
25
|
+
),
|
|
26
|
+
),
|
|
27
|
+
]
|
|
File without changes
|
example/demo/models.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from django.db import models
|
|
2
|
+
from django_nepkit import (
|
|
3
|
+
NepaliDateField,
|
|
4
|
+
NepaliTimeField,
|
|
5
|
+
NepaliPhoneNumberField,
|
|
6
|
+
NepaliDateTimeField,
|
|
7
|
+
ProvinceField,
|
|
8
|
+
DistrictField,
|
|
9
|
+
MunicipalityField,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Person(models.Model):
|
|
14
|
+
name = models.CharField(max_length=100)
|
|
15
|
+
birth_date = NepaliDateField()
|
|
16
|
+
registration_time = NepaliTimeField(auto_now_add=True)
|
|
17
|
+
phone_number = NepaliPhoneNumberField()
|
|
18
|
+
|
|
19
|
+
# Address chaining
|
|
20
|
+
province = ProvinceField()
|
|
21
|
+
district = DistrictField()
|
|
22
|
+
municipality = MunicipalityField()
|
|
23
|
+
created_at = NepaliDateTimeField(auto_now_add=True)
|
|
24
|
+
updated_at = NepaliDateTimeField(auto_now=True)
|
|
25
|
+
|
|
26
|
+
def __str__(self):
|
|
27
|
+
return self.name
|
example/demo/tests.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Create your tests here.
|
example/demo/urls.py
ADDED
example/demo/views.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from django.shortcuts import render, redirect
|
|
2
|
+
from .models import Person
|
|
3
|
+
from django import forms
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class PersonForm(forms.ModelForm):
|
|
7
|
+
class Meta:
|
|
8
|
+
model = Person
|
|
9
|
+
fields = [
|
|
10
|
+
"name",
|
|
11
|
+
"birth_date",
|
|
12
|
+
"phone_number",
|
|
13
|
+
"province",
|
|
14
|
+
"district",
|
|
15
|
+
"municipality",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def person_list(request):
|
|
20
|
+
persons = Person.objects.all()
|
|
21
|
+
return render(request, "demo/person_list.html", {"persons": persons})
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def person_create(request):
|
|
25
|
+
if request.method == "POST":
|
|
26
|
+
form = PersonForm(request.POST)
|
|
27
|
+
if form.is_valid():
|
|
28
|
+
form.save()
|
|
29
|
+
return redirect("demo:person-list")
|
|
30
|
+
else:
|
|
31
|
+
form = PersonForm()
|
|
32
|
+
return render(request, "demo/person_form.html", {"form": form})
|
|
File without changes
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
4
|
+
|
|
5
|
+
SECRET_KEY = "django-insecure-#=02g9%#k0t!(0968j4f#=+u%l-ws3nfti*0n601@n_zo(&x%w"
|
|
6
|
+
DEBUG = True
|
|
7
|
+
ALLOWED_HOSTS = []
|
|
8
|
+
|
|
9
|
+
INSTALLED_APPS = [
|
|
10
|
+
"django.contrib.admin",
|
|
11
|
+
"django.contrib.auth",
|
|
12
|
+
"django.contrib.contenttypes",
|
|
13
|
+
"django.contrib.sessions",
|
|
14
|
+
"django.contrib.messages",
|
|
15
|
+
"django.contrib.staticfiles",
|
|
16
|
+
"django_nepkit",
|
|
17
|
+
"demo",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
MIDDLEWARE = [
|
|
21
|
+
"django.middleware.security.SecurityMiddleware",
|
|
22
|
+
"django.contrib.sessions.middleware.SessionMiddleware",
|
|
23
|
+
"django.middleware.common.CommonMiddleware",
|
|
24
|
+
"django.middleware.csrf.CsrfViewMiddleware",
|
|
25
|
+
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
|
26
|
+
"django.contrib.messages.middleware.MessageMiddleware",
|
|
27
|
+
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
ROOT_URLCONF = "example_project.urls"
|
|
31
|
+
|
|
32
|
+
TEMPLATES = [
|
|
33
|
+
{
|
|
34
|
+
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
35
|
+
"DIRS": [],
|
|
36
|
+
"APP_DIRS": True,
|
|
37
|
+
"OPTIONS": {
|
|
38
|
+
"context_processors": [
|
|
39
|
+
"django.template.context_processors.request",
|
|
40
|
+
"django.contrib.auth.context_processors.auth",
|
|
41
|
+
"django.contrib.messages.context_processors.messages",
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
WSGI_APPLICATION = "example_project.wsgi.application"
|
|
48
|
+
|
|
49
|
+
DATABASES = {
|
|
50
|
+
"default": {
|
|
51
|
+
"ENGINE": "django.db.backends.sqlite3",
|
|
52
|
+
"NAME": BASE_DIR / "db.sqlite3",
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
AUTH_PASSWORD_VALIDATORS = [
|
|
57
|
+
{
|
|
58
|
+
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
|
|
68
|
+
},
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
LANGUAGE_CODE = "en-us"
|
|
72
|
+
TIME_ZONE = "Asia/Kathmandu"
|
|
73
|
+
USE_I18N = True
|
|
74
|
+
USE_TZ = True
|
|
75
|
+
|
|
76
|
+
STATIC_URL = "static/"
|
example/manage.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""Django's command-line utility for administrative tasks."""
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def main():
|
|
9
|
+
"""Run administrative tasks."""
|
|
10
|
+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
|
11
|
+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example_project.settings")
|
|
12
|
+
try:
|
|
13
|
+
from django.core.management import execute_from_command_line
|
|
14
|
+
except ImportError as exc:
|
|
15
|
+
raise ImportError(
|
|
16
|
+
"Couldn't import Django. Are you sure it's installed and "
|
|
17
|
+
"available on your PYTHONPATH environment variable? Did you "
|
|
18
|
+
"forget to activate a virtual environment?"
|
|
19
|
+
) from exc
|
|
20
|
+
execute_from_command_line(sys.argv)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
if __name__ == "__main__":
|
|
24
|
+
main()
|