darklow / django-suit

Modern theme for Django admin interface
http://djangosuit.com/
Other
2.31k stars 701 forks source link

SortableStackedInline empty forms do not save #656

Open kennydude opened 6 years ago

kennydude commented 6 years ago

Saving a form using SortableStackedInline from the admin causes blank entries to fail with the basis the forms aren't classed as empty.

The order parameter used to sort the boxes on the screen seems to be flagged as changed (as it is by the Javascript).

Django version: 1.11.1 Django Suit version: 0.2.25 Python version: 3.5.2

Currently I've implemented a hacky workaround by adding a custom ModelForm and then overriding a method like so:

from django.forms import ModelForm
from django.utils.functional import cached_property

class RewardForm(ModelForm):
    # ...
    @cached_property
    def changed_data(self):
        data = super().changed_data
        if 'order' in data:
            data.remove('order')
        return data