Coder Social home page Coder Social logo

jp74 / django-suit-sortable Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 8.0 183 KB

Drag-and-drop ordering for objects and inlines in Django admin using django-suit.

License: BSD 3-Clause "New" or "Revised" License

Python 53.67% Shell 33.55% CSS 0.01% JavaScript 12.78%

django-suit-sortable's People

Contributors

mishbahr avatar philippbosch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-suit-sortable's Issues

null value in column "order" violates not-null constraint

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?

All inlines become sortable

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.

Sortable won't work with tabular inline

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.