Issue with tags in a nested snippet model
See original GitHub issueIssue Summary
I have a simple Quiz snippet whith questions and answers. The answers are nested and in relation to the question. The answers also have tags configured to them. On saving this causes an exception because of the nested tags and formsets. [‘ManagementForm data is missing or has been tampered with’]
Steps to Reproduce
@register_snippet
@python_2_unicode_compatible
class QuizQuestion(ClusterableModel):
question = models.CharField(max_length=255)
panels = [
FieldPanel('question', classname="full"),
InlinePanel('quiz_answer_list', label="Answers"),
]
def __str__(self):
return self.vraag
class QuizAnswerTag(TaggedItemBase):
content_object = ParentalKey('tools.QuizAnswer', on_delete=models.CASCADE, related_name='quiz_tagged_items')
class QuizAnswer(ClusterableModel, Orderable):
question = ParentalKey(QuizQuestion, related_name='quiz_answer_list')
answer = models.CharField(max_length=255)
tags = ClusterTaggableManager(through=QuizAnswerTag, blank=True)
panels = [
FieldPanel('answer'),
FieldPanel('tags'),
]
Create a question with some answers. Saving will throw the exception.
- I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: yes
Technical details
Python: 3.6.8 Django 2.1.9 Wagtail version: 2.5.x
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Wagtail - having trouble rendering data with related snippets ...
I have the following code for a wagtail page from django.db import models from django import forms from ...
Read more >Snippets: Frequently Asked Questions - Iterable Support Center
I'm having trouble with HTML tags in my snippets. What should I do? Can I nest snippets inside each other? Can I use...
Read more >Add Nested Tags from the Content Builder Library
You can now add tags from the Content Builder library by selecting an asset and clicking the tag icon.
Read more >NestedSnippet - Shopify Developers
Reports deeply nested render tags or include tags. ... The following example includes a series of nested snippets: templates/index.liquid.
Read more >Tag Validator - LeetCode
Given a string representing a code snippet, implement a tag validator to parse ... you also need to consider the issue of unbalanced...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
PR created: https://github.com/wagtail/django-modelcluster/pull/119
I’ve made it so that the ‘ignore missing formsets’ behaviour only applies when formsets are not specified explicitly - this way, when we implement the proper fix of specifying the formsets on the Wagtail side, the ‘hackiness’ (i.e. ignoring a potentially legitimate error case) is confined to a legacy code path, and so we don’t need to consider a backwards-incompatible 6.x release to remove the hack.
This fix is now released as django-modelcluster version 4.4.1 and 5.0.1 - the one remaining task we ought to do here is turn @johannesvogel’s example project into a test case on the Wagtail side, so that we can catch any future regressions in this setup.