
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
django-cascading-dropdown-widget
Advanced tools
Provide a cascading-dropdown widget for django.
pip install django-cascading-dropdown-widget
pro/settings.py
Note:
INSTALLED_APPS = [
...
'django_cascading_dropdown_widget',
...
]
app/admin.py
Note:
from django.contrib import admin
from django_cascading_dropdown_widget.widgets import DjangoCascadingDropdownWidget
from django_cascading_dropdown_widget.widgets import CascadingModelchoices
from django import forms
from .models import Category
from .models import Book
from .models import Character
class CharacterForm(forms.ModelForm):
class Meta:
model = Category
exclude = []
widgets = {
"book": DjangoCascadingDropdownWidget(choices=CascadingModelchoices({
"model": Category,
"related_name": "books",
},{
"model": Book,
"fk_name": "category",
})),
}
class CharacterAdmin(admin.ModelAdmin):
form = CharacterForm
list_display = ["name", "book"]
class CascadingModelchoices(object):
def __init__(self, *cascadings):
...
The parameters for CascadingModelchoices generator are the CASCADING-MODEL-SETTINGS(name it cascadings for short). A MODEL-SETTING(name it cascading for short)'s config items are:
class SimpleChoices(object):
def __init__(self, *cascadings, empty1="-"*10, empty2="-"*10):
...
Use CascadingModelchoices for the generator.
Create indented_title function for the MPTTModel. You use whatever name for the indented_title.
class MyModel(MPTTModel):
def indented_title(self):
return ("-"*4) * self.get_level() + self.name
Setting "str": "indented_title"
in cascading.
The application django-cascading-dropdown-widget is NOT required django-mptt, so install django-mptt by youself. We have did try...except... with django-mptt's missing.
$(document).on("change", ".django-cascading-dropdown-widget-select", function(){...})
instead of arrive
monitor. So now we do NOT depends on django-static-arrive.white-space: nowrap;
for django-cascading-dropdown-widget.FAQs
Provide a cascading-dropdown widget for django.
We found that django-cascading-dropdown-widget demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.