
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
django-suit-sortable
Advanced tools
Drag-and-drop ordering for objects and inlines in Django admin using django-suit.
Drag-and-drop ordering for objects and inlines in Django admin using django-suit.
pip install -e git://github.com/JP74/django-suit-sortable.git#egg=suit_sortable
suit_sortable
to your INSTALLED_APPS
.django.core.context_processors.static
is in your TEMPLATE_CONTEXT_PROCESSORS
.To use suit_sortable you must do following:
In your models.py
file add integer property for sortable to you model:
from django.db import models
class Category(models.Model):
...
position = models.PositiveIntegerField()
If you're adding Sorting to an existing model, it is recommended that you use django-south to create a schema migration to add the "position" field to your model. You will also need to create a data migration in order to add the appropriate values for the position
column.
Example assuming a model named "Category":
def forwards(self, orm):
for index, category in enumerate(orm.Category.objects.all()):
category.position = index + 1
category.save()
To enable sorting in the admin, you need to inherit from SortableAdmin
and add a list_editable
column for the position
field:
from django.contrib import admin
from myapp.models import MySortableClass
from suit_sortable.admin import SortableAdmin
class MySortableAdminClass(SortableAdmin):
list_display = (..., 'position',)
list_editable = ('position',)
"""Any other admin options you need go here"""
admin.site.register(MySortableClass, MySortableAdminClass)
To enable sorting on TabularInline models, you need to inherit from SortableTabularInline:
from suit_sortable.admin import SortableTabularInline
class MySortableTabularInline(SortableTabularInline):
"""Your inline options go here"""
To enable sorting on StackedInline models, you need to inherit from SortableStackedInline:
from suit_sortable.admin import SortableStackedInline
class MySortableStackedInline(SortableStackedInline):
"""Your inline options go here"""
Since sortables are based on JavaScript solution, there are known limitations:
0.1.0 (2013-08-15) ++++++++++++++++++
FAQs
Drag-and-drop ordering for objects and inlines in Django admin using django-suit.
We found that django-suit-sortable 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.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.