question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

StreamField: js error in adding component field

See original GitHub issue

Issue Summary

Error in back-office when trying to add items in a StreamField

Steps to Reproduce

  1. Define a StreamField :
class EventPage(PublicationItemPage):
    """
    Simple event, providing:

    + date/time start
    + date/time end
    + location
    + audience
    + a signup link
    """
    #: Date from
    date_from = models.DateField(verbose_name=_('Start date'))

    #: Date to
    date_to = models.DateField(verbose_name=_('End date'),
                               null=True, blank=True,
                               help_text=_('Not required if event is on a single day'))

    #: Time from
    time_from = models.TimeField(verbose_name=_('Start time'), null=True, blank=True)

    #: Time to
    time_to = models.TimeField(verbose_name=_('End time'), null=True, blank=True)

    #: Audience can be `private` or `public`
    audience = models.CharField(verbose_name=_('Audience'), max_length=255, choices=EVENT_AUDIENCE_CHOICES)

    #: A Location
    location = models.ForeignKey('publications.Location',
                                 verbose_name=_('Location'),
                                 on_delete=models.SET_NULL,
                                 null=True, blank=True)

    #: A description of the event
    body = StreamField([('paragraph', blocks.RichTextBlock()),
                        ('image', ImageChooserBlock()),
                        ('url', blocks.URLBlock()),
                        ('date', blocks.DateBlock()),
                        ('page', blocks.PageChooserBlock())],
                       verbose_name=_('Body'),
                       null=True, blank=True)
  1. Defines some content panels
# Content panels
    content_panels = [FieldPanel('title', classname="full title"),
                      FieldPanel('date_from'),
                      FieldPanel('date_to'),
                      FieldPanel('time_from'),
                      FieldPanel('time_to'),
                      FieldPanel('location'),
                      FieldPanel('audience'),
                      FieldPanel('signup_link'),
                      FieldPanel('body'), ]
  1. When adding a new Event, I’ve some weird comportment

  2. When recording, I’ve a 500 error :

Internal Server Error: /admin/pages/add/publications/eventpage/7/

MultiValueDictKeyError at /admin/pages/add/publications/eventpage/7/ “u’body-0-deleted’”

Technical details

  • Python version: 2.7.9
  • Django version: 1.10.6
  • Wagtail version: 1.9
  • Browser version: firefox 51 / firefox 52 / chrome 57

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
frague59commented, Mar 13, 2017

Yeah, got it, StreamFieldPanel solves the problem, Sorry !

1reaction
Proper-Jobcommented, Mar 13, 2017

@frague59 Did you see my comment, I believe we commented at the same time? Did that solve your issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Stream Field in WagTail throws an error in block content
Error message is: 'richtext' template filter received an invalid value; expected string, got <class 'wagtail.core.blocks.stream_block.
Read more >
How to use StreamField for mixed content
StreamField is a model field that can be defined within your page model like any ... be used - including using it as...
Read more >
Solved: Can't add Components Field to Issue Context and Ne...
Go to project settings > Issue types; Locate the issue type to which you want to add the component and click on the...
Read more >
SQL Error Messages | InterSystems IRIS Data Platform 2022.2
The table below lists the SQL numeric error codes and their error ... -21, Pointer->Field reference may not be modified by an INSERT...
Read more >
Custom StreamField Field Validation - LearnWagtail.com
Occasionally we as developers would like to add additional field validation to ... if errors: raise ValidationError('Validation error in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found