Skip to content

Model attribute 'dataset' makes it impossible to save form detail page #2116

Description

@vvmruder

Did you used AI to write this issue?

No

What version of Unfold are you using?

0.96.0

What version of Django are you using?

6.0.6

What browser are you using?

Vivaldi 8.0.4033.46
Mozilla Firefox 151.0.4
Chromium 149.0.7827.53

Did you checked changelog/commit history, if the bug is not already fixed?

Yes

Did you searched other issues, if the bug is not already fixed?

Yes

Did you checked documentation?

Yes

Are you able to replicate the bug in the demo site?

No, I did not try that

Repository with reproduced bug

I think the example below shows it well.

Describe your issue

I hit a limitation which I could not found documented and it took some investigation to find out what was happening.

A model like:

class Test(models.Model):
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, )
    dataset = models.CharField()

Registering it to admin with:

@admin.register(Test)
class TestAdmin(ModelAdmin):
    pass

Leads to the following error on saving forms based on that model:
Items must be selected in order to perform actions on them. No items have been changed.

I found that, dataset is acutally a reserved name when it comes to form handling in unfold:
https://github.com/unfoldadmin/django-unfold/blob/main/src/unfold/mixins/dataset_model_admin.py#L49

This is a bit unfortunate since its not documented and hidden. Wouldn't be there a much safer implementation in adding a hidden _dataset or even _unfold_dataset field to the post instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions