Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joined columns in SortableInlineAdminMixin #282

Open
tfeldmann opened this issue Sep 6, 2021 · 1 comment
Open

Joined columns in SortableInlineAdminMixin #282

tfeldmann opened this issue Sep 6, 2021 · 1 comment

Comments

@tfeldmann
Copy link

tfeldmann commented Sep 6, 2021

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant