Skip to content

Using InstanceSelectorPanel with ClusterableModel #10

@OBKF

Description

@OBKF

Hello,
I am using InstanceSelectorPanel to provide a way to add ForeignKey values to a model with search (since the data may be huge later on), also I want to use Orderable to provide images to my model.

Now I have this error: "<Hotel: Hotel object (None)>" needs to have a value for field "id" before this many-to-many relationship can be used.

code:

class Place(models.Model):
    name = models.CharField(
        verbose_name=_("name"), max_length=128, blank=True, null=True)
    ...
    class Meta:
        abstract = True
        ordering = ['-date']

class Hotel(ClusterableModel, Place):
    panels = [
        MultiFieldPanel(
            [
                FieldPanel("name"),
                ...
            ],
            heading="base Options",
        ),
        MultiFieldPanel(
            [
                FieldPanel("rooms"),
                ...
                InstanceSelectorPanel("city"), <--------------------------------------------------------------
            ],
            heading="Other Options",
        ),
        MultiFieldPanel(
            [InlinePanel("images", max_num=10, min_num=1, label="Image")],
            heading="Images",
        ),
    ]

So is there any possible way I can go around this ?

Thanks.

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