wagtail-snippet

Wagtail SnippetChooserBlock in Streamfield

主宰稳场 提交于 2021-02-07 08:58:33
问题 I am having some trouble getting the values from a snippet, that I have included into a streamfield using a Snippet Chooser Block. BioSnippet: @register_snippet class BioSnippet(models.Model): name = models.CharField(max_length=200, null=True) job_title = models.CharField(max_length=200, null=True, blank=True) bio = RichTextField(blank=True) image = models.ForeignKey( 'wagtailimages.Image', null=True, blank=True, on_delete=models.SET_NULL, related_name='+', verbose_name='Bio Image' ) contact

Wagtail SnippetChooserBlock in Streamfield

[亡魂溺海] 提交于 2021-02-07 08:57:16
问题 I am having some trouble getting the values from a snippet, that I have included into a streamfield using a Snippet Chooser Block. BioSnippet: @register_snippet class BioSnippet(models.Model): name = models.CharField(max_length=200, null=True) job_title = models.CharField(max_length=200, null=True, blank=True) bio = RichTextField(blank=True) image = models.ForeignKey( 'wagtailimages.Image', null=True, blank=True, on_delete=models.SET_NULL, related_name='+', verbose_name='Bio Image' ) contact

How to set multiple ParentalKeys to Wagtail TaggedItemBase tag class

蹲街弑〆低调 提交于 2020-12-23 08:19:07
问题 I have two different page models (no subclassing, separate apps with only similar fields being common ones like "model name", "id", "parts") , let's say, cars and motorcycles. I'm making a separate page with a table of their parts (which also needs to contain columns like "id" which i assume can be a pk,"web store link", and "used by" which will show all Bike and Car models that use the part); Since they can share a few of the same parts, I want for them to be connected to the same Tag model

How to set multiple ParentalKeys to Wagtail TaggedItemBase tag class

自作多情 提交于 2020-12-23 08:18:12
问题 I have two different page models (no subclassing, separate apps with only similar fields being common ones like "model name", "id", "parts") , let's say, cars and motorcycles. I'm making a separate page with a table of their parts (which also needs to contain columns like "id" which i assume can be a pk,"web store link", and "used by" which will show all Bike and Car models that use the part); Since they can share a few of the same parts, I want for them to be connected to the same Tag model

How to set multiple ParentalKeys to Wagtail TaggedItemBase tag class

允我心安 提交于 2020-12-23 08:17:19
问题 I have two different page models (no subclassing, separate apps with only similar fields being common ones like "model name", "id", "parts") , let's say, cars and motorcycles. I'm making a separate page with a table of their parts (which also needs to contain columns like "id" which i assume can be a pk,"web store link", and "used by" which will show all Bike and Car models that use the part); Since they can share a few of the same parts, I want for them to be connected to the same Tag model

Wagtail admin ,CheckboxSelectMultiple not saving data

血红的双手。 提交于 2019-12-13 16:05:58
问题 @register_snippet class Numbers(models.Model): number = models.IntegerField() class State(models.Model): state = models.CharField(max_length=100) number = ParentalManyToManyField(Numbers) class HomeStateNumber(State): page = ParentalKey('home.HomePage', related_name='helpline') api_fields = ['state', 'number'] panels = [ FieldPanel('state'), FieldPanel('number',widget=forms.CheckboxSelectMultiple), ] class HomePage(Page): content_panels = [ FieldPanel('title'), ImageChooserPanel('cover_page')

Extending Hallojs in Django Wagtail With Edit Source Button

流过昼夜 提交于 2019-12-12 18:52:37
问题 I've been abel to add an an 'Edit Html' source button to my editor with the following hook: @hooks.register('insert_editor_js') def enable_source(): return format_html( """ <script> registerHalloPlugin('hallohtml'); </script> """ ) It adds a button, but I can't figure out how to add an icon - see screenshot below with no icon. All buttons except no icon make the source editor work great. Thank you for your help. 回答1: Use the insert_editor_css hook to provide additional CSS files to the editor