jp74 / django-suit-sortable Goto Github PK
View Code? Open in Web Editor NEWDrag-and-drop ordering for objects and inlines in Django admin using django-suit.
License: BSD 3-Clause "New" or "Revised" License
Drag-and-drop ordering for objects and inlines in Django admin using django-suit.
License: BSD 3-Clause "New" or "Revised" License
I am using SortableTabularInline and cannot insert new inline items. The documentation covers SortableAdmin with an example, but it's not very specific about how to use django-suit-sortable for SortableTabularInline
, so maybe i got something wrong.
this is my admin configuration:
class TipInline(SortableTabularInline):
model = Tip
extra = 0
sortable = 'order'
fields = ('username', 'text')
suit_classes = 'suit-tab suit-tab-items'
When I create a new inline Tip, the order field is left null. Any idea how it can work?
I have multiple inlines a change form.
However, the javascript considers all inlines should be sortable, wether or not it's desired.
cf.
$('.inline-related')... // takes all inlines
This has bad side effects.
In my case, if my non-sortable inline has 0 items, it would break the rightful sortable inline because of this :
if($('.inline-related input[name$=-INITIAL_FORMS]').val() <= 1){
return;
}
I will send a fix & PR for that.
Hi,
I tried django-suit-sortable,
I have encountered a problem where the drag and drop wont work (won't init, i guess) with my tabular inline.
I will describe the situation:
I have an item model which has several pictures held by Filer. I have an intermediate table to hold the image and link it to the item (to link numeral pictures to a single item).
So, I have:
Item model
Item2Picture model
Item2PictureInline
ItemAdmin calling the Item2PictureInline
As you suggested, I have a position field in Item2Picture model, and Item2PictureInline inherited from SortableTabularInline.
This work work, I do not know why.
However, I tried to add SortableAdmin to the ItemAdmin just to see if it will work, and it had. I was able to change the order of my items in the change list.
What seems to be the problem here, i ask? :(
Thanks in advance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.