Questions tagged [wagtail-snippet]

72 questions
7
votes
2 answers

How to obtain database id from the struct_block.StructValue in the wagtail block template?

Building a custom template for the wagtail StreamField block I found myself in the situation that I need somehow pass the ID of the current block to the other views. For instance when the URL is clicked in the particular block, the landing page view…
NarūnasK
  • 4,564
  • 8
  • 50
  • 76
7
votes
1 answer

Use of StreamField in Snippets on Wagtail

I am trying to build some structured snippets on my Wagtail site. I looked through the documentation, but saw nothing on this point (forgive me if I missed it). Is it possible to use StreamField inside of a Snippet? Or, only on Pages
Adam Hopkins
  • 6,837
  • 6
  • 32
  • 52
6
votes
2 answers

Use Wagtail CMS Snippets but Hide in Admin Panel

I am building custom AdminModels based on Wagtail Snippets and have a custom menu in the AdminPanel for my models. How do I hide/remove the Snippet selection from AdminPanel without disabling? Thank you.
Charles Smith
  • 3,201
  • 4
  • 36
  • 80
4
votes
0 answers

Inline creation of snippet in a streamfield block (Wagtail 2.3+)

so lets say I have the following models set up for Wagtail: @register_snippet class MySnippet(models.Model): name = models.CharField(max_length=200, null=True) panels = [FieldPanel('name'),] def __str__(self): return self.name …
thclark
  • 4,784
  • 3
  • 39
  • 65
3
votes
1 answer

Wagtail Orderable in Orderable Bug?

I want to create multiple submenus for different pages of a website. So, I created a snippet called "Submenus". The submenu contains an object called submenu_items. On the webpage, that translates to the top level of navigation. Then, each…
JustBlossom
  • 1,259
  • 3
  • 24
  • 53
3
votes
1 answer

Injecting snippets into a Wagtail StreamField interface

My company is using Wagtail to build robust pages for our website, likely using the StreamField component. We're wondering if Wagtail allows the possibility of us creating reusable parts (perhaps in a snippet), and injecting them into a page. I'm…
commadelimited
  • 5,656
  • 6
  • 41
  • 77
3
votes
1 answer

Wagtail Hide/Show menu item by user permissions

How to hide-show menu in wagtail CMS: Here is my code on register_admin_menu_item hook inside blog/wagtail_hooks.py from wagtail.core import hooks from wagtail.admin.menu import MenuItem @hooks.register('register_admin_menu_item') …
Prakash Kumar
  • 2,554
  • 2
  • 18
  • 28
3
votes
1 answer

Wagtail admin ,CheckboxSelectMultiple not saving data

@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 =…
sourabhah
  • 424
  • 4
  • 16
3
votes
2 answers

Wagtail SnippetChooserBlock in Streamfield

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) …
2
votes
1 answer

How customize chooser views and add a specific widget to a field using wagtail-generic-chooser

I want to override the basic view in the Article snippet selector, which does not display the checkbox correctly. class ArticleChooserMixin(ModelChooserMixin): def get_edit_item_url(self, item): # for Wagtail 4.x return reverse( …
Tom
  • 23
  • 3
2
votes
1 answer

Wagtail: How to order snippets

I am creating Wagtail Snippets for things like Country and State, but also for other features like Transportation Options. I am surprised that there is no ability to Order snippet display in "picker" panels. "Snippets lack many of the features of…
Chris Shenton
  • 125
  • 1
  • 13
2
votes
1 answer

What is the best way to setup default snippets in Wagtail

I would like to setup default snippets (article categories) in a Wagtail blog project. My option would be to add the following line at the end of the models.py module: if BlogPageCategory.objects.filter(name = 'Association').count() == 0: …
blondelg
  • 916
  • 1
  • 8
  • 25
2
votes
1 answer

Using Wagtail Collections for Images via Snippet, how do you iterate through them for display in templates?

I have a site that uses a lot of images (a page can range from 12-40 subject to requirements). User experience of adding a single image at a time using the ImageChooserPanel is rather poor. I think adding all images to a collection and then applying…
vmox
  • 41
  • 5
2
votes
1 answer

How to make a ManyToOne in Wagtail with RadioSelect on admin page?

I would like to set up a radio select option in admin for my blog's category. ManyToMany fields do not work with a RadioSelect widget. I want the category to be a ManyToOne relationship with the articles. Right now I have a ParentalManyToMany field…
AJH
  • 265
  • 2
  • 12
2
votes
0 answers

How can I use Django's translation strings with Wagtailtrans (Add-on for supporting multi language Wagtail sites)

So I have a website which is using the Wagtailtrans extension for Wagtail. I basically enables multi language by duplicating the page tree. So the url gets fixed with the language-code at the start. I can translate all my content which I define…
1
2 3 4 5