jrief / django-admin-sortable2

Generic drag-and-drop ordering for objects in the Django admin interface
https://django-admin-sortable2.readthedocs.io/en/latest/
Other
776 stars 180 forks source link

Joined columns in SortableInlineAdminMixin #282

Open tfeldmann opened 3 years ago

tfeldmann commented 3 years ago

See the screenshot, the amount column is joined into the part column. Any clues?

Bildschirmfoto 2021-09-06 um 18 30 50

My definitions:

class BOMPartInline(SortableInlineAdminMixin, admin.TabularInline):
    model = BOMPart
    fields = ("order", "amount", "part", "notice")
    autocomplete_fields = ("part",)
    formfield_overrides = {
        models.DecimalField: {"widget": forms.NumberInput(attrs={"step": 1})}
    }
    extra = 0
class BOMPart(models.Model):
    created_at = models.DateTimeField(auto_now_add=True, editable=False)
    order = models.PositiveIntegerField(default=0, blank=False, null=False)

    amount = models.DecimalField(max_digits=15, decimal_places=3)
    notice = models.CharField(max_length=200, blank=True)

    bom = models.ForeignKey(
        BOM,
        on_delete=models.CASCADE,
        related_name="parts",
    )
    part = models.ForeignKey(
        Part,
        on_delete=models.RESTRICT,
        null=True,
        blank=True,
    )

    class Meta:
        ordering = ["order"]
tfeldmann commented 3 years ago

I'm using Django 3.2.6 with django-admin-sortable2 1.0 from pypi.