!FJAJZqQPBEhpfWUdpy:matrix.org

Wagtail Support

358 Members
https://github.com/wagtail/wagtail/wiki/Slack#support29 Servers

Load older messages


SenderMessageTime
26 Dec 2020
@lynn:privacytools.iolynn left the room.11:44:36
@kimshiland:utwente.iokimshiland left the room.23:47:49
27 Dec 2020
@desmond:riotchat.dedesmond left the room.11:42:09
@cyril:fairydust.spacecyril 17:42:55
@cyril:fairydust.spacecyril left the room.18:23:58
28 Dec 2020
@leandro:halogen.cityleandro 11:15:11
@leandro:halogen.cityleandro left the room.11:56:42
@ringo:matrixim.ccringo left the room.12:58:55
@scott:perthchat.orgscott left the room.20:50:20
@paul:perthchat.orgpaul left the room.21:43:34
10 Jan 2021
@jojo:peek-a-boo.atjojo joined the room.10:06:00
@jojo:peek-a-boo.atjojoHi, I have an issue with "Validation Errors" with nested Orderable models. Best described with a picture at first:10:10:06
@jojo:peek-a-boo.atjojoScreen Shot 2021-01-10 at 10.53.49.png
Download Screen Shot 2021-01-10 at 10.53.49.png
10:10:19
@jojo:peek-a-boo.atjojo I have a page type called "CoursePage" - on this Page multiple Orderables "CourseDates" can be added - furthermore each CourseDate can have one or more "CourseTimes". Relation is made via using ParentalKey. 10:12:35
@jojo:peek-a-boo.atjojo

The CoursePage has this content panel:

        MultiFieldPanel(
            [
                InlinePanel(
                    "course_dates",
                    max_num=100,
                    min_num=1,
                    label="Date",
                    classname="")
            ],
            heading="Course dates (add up to 100 dates)",
            classname="collapsible"
        ),
10:14:01
@jojo:peek-a-boo.atjojo *

The CoursePage has this Miltufield content panel:

        MultiFieldPanel(
            [
                InlinePanel(
                    "course_dates",
                    max_num=100,
                    min_num=1,
                    label="Date",
                    classname="")
            ],
            heading="Course dates (add up to 100 dates)",
            classname="collapsible"
        ),
10:14:13
@jojo:peek-a-boo.atjojo

This is the CourseDates model

class CourseDates(ClusterableModel, Orderable):
    """multiple course dates for the course page."""
    page = ParentalKey("kswebsite.CoursePage", related_name="course_dates")

    class Meta:
        ordering = ['date']

    date = models.DateField(
        "Date",
        auto_now=False,
        auto_now_add=False,
        null=True,
        blank=False,
    )

    panels = [
        FieldPanel("date", classname=""),
        InlinePanel(
            "course_times", max_num=5, min_num=1, label="Time",
            heading="Add course times"
        )
    ]
10:14:48
@jojo:peek-a-boo.atjojo

And finally the CourseTimes model:

class CourseTimes(Orderable):
    """multiple course times for the CourseDates Orderable."""
    date_parent = ParentalKey(
        "kswebsite.CourseDates",
        related_name="course_times",
        null=True,
        blank=False,
        on_delete=models.SET_NULL,
    )

    time_from = models.TimeField(
        "From",
        auto_now=False,
        auto_now_add=False,
        null=True,
        blank=True,
    )
    time_to = models.TimeField(
        "To",
        auto_now=False,
        auto_now_add=False,
        null=True,
        blank=True,
    )
    time_description = models.CharField(
        "Descr",
        max_length=20,
        default="Kurseinheit",
        null=True,
        blank=True,
    )

    panels = [
        FieldRowPanel(
            [
                FieldPanel("time_from", classname=""),
                FieldPanel("time_to", classname=""),
            ],
        ),
        FieldPanel("time_description", classname=""),
    ]
10:15:29
@jojo:peek-a-boo.atjojo *

And finally the CourseTimes model:

class CourseTimes(Orderable):
    """multiple course times for the CourseDates Orderable."""
    date_parent = ParentalKey(
        "kswebsite.CourseDates",
        related_name="course_times",
        null=True,
        blank=False,
        on_delete=models.SET_NULL,
    )

    time_from = models.TimeField(
        "From",
        auto_now=False,
        auto_now_add=False,
        null=True,
        blank=False,
    )
    time_to = models.TimeField(
        "To",
        auto_now=False,
        auto_now_add=False,
        null=True,
        blank=False,
    )
    time_description = models.CharField(
        "Descr",
        max_length=20,
        default="Kurseinheit",
        null=True,
        blank=False,
    )

    panels = [
        FieldRowPanel(
            [
                FieldPanel("time_from", classname=""),
                FieldPanel("time_to", classname=""),
            ],
        ),
        FieldPanel("time_description", classname=""),
    ]
10:16:29
@jojo:peek-a-boo.atjojo *

The CoursePage has this Multifield content panel:

        MultiFieldPanel(
            [
                InlinePanel(
                    "course_dates",
                    max_num=100,
                    min_num=1,
                    label="Date",
                    classname="")
            ],
            heading="Course dates (add up to 100 dates)",
            classname="collapsible"
        ),
10:17:07
@jojo:peek-a-boo.atjojoI can successfully add multiple CourseDates to a CoursePage10:18:19
@jojo:peek-a-boo.atjojoThen save and afterwards add a CourseTime to this Date10:19:05
@jojo:peek-a-boo.atjojoBut whenever I choose to add a CourseDate AND addtitionally at the same time add a CourseTime, and then click save draft or publish, I get the following Validation Errors:10:23:02
@jojo:peek-a-boo.atjojoScreen Shot 2021-01-10 at 11.22.22.png
Download Screen Shot 2021-01-10 at 11.22.22.png
10:23:08
@jojo:peek-a-boo.atjojoScreen Shot 2021-01-10 at 11.23.16.png
Download Screen Shot 2021-01-10 at 11.23.16.png
10:23:32
@jojo:peek-a-boo.atjojoObviously the CourseDate is saved properly but the CourseTime is not10:24:00
@jojo:peek-a-boo.atjojoI had a look in the database to understand the relations between the tables better and my vague guess is that wagtail tries to save the CourseDates and CourseTimes at the same time. This can't work because the CourseDates entry/primary key has to exist prior to adding a related CourseDate in the coursedates table. 10:26:24
@jojo:peek-a-boo.atjojoIs anyone still with me and would like to kindly point me in the right direction? Long story short: How would I advise wagtail admin panel to save the data in the correct order: First save to the CourseDates table - and only THEN save to the CourseTimes table.10:27:51
@jojo:peek-a-boo.atjojoThanks in advance for any hints how to solve this! :-)10:28:06
12 Jan 2021
@jojo:peek-a-boo.atjojoNot much going on in this room. Just if anyone is read my issue here anyway I now took the time to file a stackoverflow question. If you are interested please go ahead and answer there: https://stackoverflow.com/questions/65680004/nested-orderables-validation-errors08:09:27

Show newer messages


Back to Room ListRoom Version: 1