Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
django-cleavejs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Libraries
django-cleavejs
Commits
595dbdd5
Verified
Commit
595dbdd5
authored
4 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Add missing options
parent
9436c03f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.rst
+4
-3
4 additions, 3 deletions
README.rst
dj_cleavejs/widgets.py
+36
-1
36 additions, 1 deletion
dj_cleavejs/widgets.py
with
40 additions
and
4 deletions
README.rst
+
4
−
3
View file @
595dbdd5
...
@@ -67,9 +67,9 @@ on any `CharField`::
...
@@ -67,9 +67,9 @@ on any `CharField`::
In your template, make sure to include the form media of your form somewhere
In your template, make sure to include the form media of your form somewhere
**after** the form.
**after** the form.
Right now, only simple fields with blocks and delimiters are supported. In the
The `CleaveWidget` supports all options `Cleave.js`_ supports, as described
future, `django-cleavejs`_ will support all `Cleave.js`_ options and also provide
in its `options documentation`_. In the future, `django-cleavejs`_ will also
pr
e-configured widgets for certain type
s.
pr
ovide shortcut
s.
Example
Example
-------
-------
...
@@ -83,4 +83,5 @@ It is reduced to a minimal working example for the reader's convenience.
...
@@ -83,4 +83,5 @@ It is reduced to a minimal working example for the reader's convenience.
.. _poetry: https://python-poetry.org/
.. _poetry: https://python-poetry.org/
.. _Cleave.js: https://nosir.github.io/cleave.js/
.. _Cleave.js: https://nosir.github.io/cleave.js/
.. _django-yarnpkg: https://edugit.org/AlekSIS/libs/django-yarnpkg
.. _django-yarnpkg: https://edugit.org/AlekSIS/libs/django-yarnpkg
.. _options documentation: https://github.com/nosir/cleave.js/blob/master/doc/options.md
.. _Git repository: https://edugit.org/AlekSIS/libs/django-cleavejs
.. _Git repository: https://edugit.org/AlekSIS/libs/django-cleavejs
This diff is collapsed.
Click to expand it.
dj_cleavejs/widgets.py
+
36
−
1
View file @
595dbdd5
...
@@ -12,11 +12,46 @@ __all__ = ("CleaveWidget",)
...
@@ -12,11 +12,46 @@ __all__ = ("CleaveWidget",)
@dataclass
@dataclass
class
CleaveWidget
(
TextInput
):
class
CleaveWidget
(
TextInput
):
#
Options as defined by the original Cleave.js
options
object
#
Generic
options
blocks
:
Optional
[
Sequence
[
int
]]
=
None
blocks
:
Optional
[
Sequence
[
int
]]
=
None
delimiter
:
Optional
[
str
]
=
None
delimiter
:
Optional
[
str
]
=
None
delimiters
:
Optional
[
Sequence
[
str
]]
=
None
delimiters
:
Optional
[
Sequence
[
str
]]
=
None
delimiterLazyShow
:
Optional
[
bool
]
=
None
delimiterLazyShow
:
Optional
[
bool
]
=
None
prefix
:
Optional
[
str
]
=
None
noImmediatePrefix
:
Optional
[
bool
]
=
None
rawValueTrimPrefix
:
Optional
[
bool
]
=
None
numericOnly
:
Optional
[
bool
]
=
None
uppercase
:
Optional
[
bool
]
=
None
lowercase
:
Optional
[
bool
]
=
None
swapHiddenInput
:
Optional
[
bool
]
=
None
# Numeral options
numeral
:
Optional
[
bool
]
=
None
numeralThousandsGroupStyle
:
Optional
[
bool
]
=
None
numeralIntegerScale
:
Optional
[
int
]
=
None
numeralDecimalScale
:
Optional
[
int
]
=
None
numeralDecimalMark
:
Optional
[
str
]
=
None
numeralPositiveOnly
:
Optional
[
bool
]
=
None
signBeforePrefix
:
Optional
[
bool
]
=
None
tailPrefix
:
Optional
[
bool
]
=
None
stripLeadingZeroes
:
Optional
[
bool
]
=
None
# Date/Time options
date
:
Optional
[
bool
]
=
None
datePattern
:
Optional
[
Sequence
[
str
]]
=
None
dateMin
:
Optional
[
str
]
=
None
dateMax
:
Optional
[
str
]
=
None
time
:
Optional
[
bool
]
=
None
timePattern
:
Optional
[
Sequence
[
str
]]
=
None
timeFormat
:
Optional
[
str
]
=
None
# Phone number options
phone
:
Optional
[
bool
]
=
None
phoneRegionCode
:
Optional
[
str
]
=
None
# Credit card number options
creditCard
:
Optional
[
bool
]
=
None
creditCardStrictMode
:
Optional
[
bool
]
=
None
attrs
:
InitVar
[
Optional
[
Dict
[
str
,
str
]]]
=
None
attrs
:
InitVar
[
Optional
[
Dict
[
str
,
str
]]]
=
None
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment