wagtail

Create a new entity from selection in draft.js / /Draftail, wrap existing text and link entities

╄→гoц情女王★ 提交于 2021-01-29 05:21:46
问题 I'm trying to create a new entity for Wagtail 's Draftail text editor (based on draft.js ). I've started off with the example here: http://docs.wagtail.io/en/v2.5.1/advanced_topics/customisation/extending_draftail.html#creating-new-entities I have the extension working as a proof of concept, in that it will take a selection and wrap it in a footnote entity. However, I need to be able to preserve existing link entities, so that they become children of the new footnote entities. I've tried

Wagtail: How to pass model instance to a widget and access it in template

风流意气都作罢 提交于 2021-01-28 18:43:10
问题 I have a model based on Wagtails Page model and I am assigning a custom widget to one of the models fields. Is it possible to make the model instance accessible in the widgets HTML-template when rendering the admin view? I need the widget in the admin view to know which ID the SimplePage has the widget belongs to, i.e. get the value of {{ page.id }} . # models.py class SimplePage(Page): name = RichTextField(blank=True) geom = PointField() content_panels = Page.content_panels + [ FieldPanel(

Wagtail - how to preopulate fields in admin form?

只愿长相守 提交于 2021-01-28 11:25:33
问题 I would like to pre-populate fields in wagtail page admin. Particularly I would like to take username of currently logged admin/editor user and fill it in the form as a string. A simplified version of my page looks like this: class ItemPage(Page): author = models.CharField(max_length=255, default="") content_panels = Page.content_panels + [ FieldPanel('author'), ] I do not want to set a default value in the author field in the model - it should be user specific. I do not want to use the save

Filtering a Wagtail index page by fields of the child pages (user-initiated query) / (FieldError at … cannot resolve keyword)

孤人 提交于 2021-01-28 11:23:48
问题 My Wagtail project is at heart just a very conventional listings page where users can browse items in the database and then click on any item of interest to go its detail page. But how do I allow users to filter and/or sort the listings on the main page by the contents of fields on the child pages? This most generic, ordinary task eludes me. Let's say the database is a collection of Things. And let's say that what people find important about each Thing are (a) the year it was discovered, and

Ways to create reusable sets of fields in Wagtail?

最后都变了- 提交于 2021-01-27 10:19:50
问题 I'm evaluating Wagtail to see if I can find a place for it along side Wordpress and Drupal in my company. So far I think it's interesting and really like a lot of it, but there's one thing I would really like and can't find a way to do it. My shop uses a pattern library (a la Atomic Design) and initially I was excited by the StreamField and it's ability to tie directly in to a pattern library, including creating nested patterns (a reusable button class that can be put in a CTA and a Hero

Custom wagtail page model save method called twice

无人久伴 提交于 2021-01-25 07:20:07
问题 In a Django+Wagtail project, I have a custom method which I call from the model save() method. It works - but everytime I save an instance via the wagtail admin interface, this method is called twice - why? # models.py from wagtail.core.models import Page class ArticlePage(Page): def my_method(self): print('I will be printed twice on save...') def save(self, *args, **kwargs): self.my_method() super().save(*args, **kwargs) By using traceback.print_stack as suggested by Håken Lid I've found out

Custom wagtail page model save method called twice

廉价感情. 提交于 2021-01-25 07:19:33
问题 In a Django+Wagtail project, I have a custom method which I call from the model save() method. It works - but everytime I save an instance via the wagtail admin interface, this method is called twice - why? # models.py from wagtail.core.models import Page class ArticlePage(Page): def my_method(self): print('I will be printed twice on save...') def save(self, *args, **kwargs): self.my_method() super().save(*args, **kwargs) By using traceback.print_stack as suggested by Håken Lid I've found out

Wagtail Documents: Large file size (>2GB) upload fails

时光怂恿深爱的人放手 提交于 2020-12-31 10:53:57
问题 I'm trying to upload a file using the built in wagtaildocs application in my Wagtail application. I've setup my Ubuntu 16.04 server was setup with the Digital Ocean tutorial methods for Nginx | Gunicorn | Postgres Some initial clarifications: In my Nginx config I've set client_max_body_size 10000M; In my production settings I have the following lines: MAX_UPLOAD_SIZE = "5242880000" WAGTAILIMAGES_MAX_UPLOAD_SIZE = 5000 * 1024 * 1024 My file type is a .zip This a production test at this point.

Is there any way to create and publish pages by executing python script in wagtail?

五迷三道 提交于 2020-12-30 04:31:46
问题 I can create and publish pages(which I have created by inheriting Page class) by using wagtail admin interface by using the process below. class HomePage(Page): template = 'tmp/home.html' def get_context(self, request): context = super(HomePage, self).get_context(request) context['child'] = PatientPage.objects.child_of(self).live() return context class PatientPage(Page): template = 'tmp/patient_page.html' parent_page_types = ['home.HomePage',] name = models.CharField(max_length=255, blank

Is there any way to create and publish pages by executing python script in wagtail?

落花浮王杯 提交于 2020-12-30 04:29:09
问题 I can create and publish pages(which I have created by inheriting Page class) by using wagtail admin interface by using the process below. class HomePage(Page): template = 'tmp/home.html' def get_context(self, request): context = super(HomePage, self).get_context(request) context['child'] = PatientPage.objects.child_of(self).live() return context class PatientPage(Page): template = 'tmp/patient_page.html' parent_page_types = ['home.HomePage',] name = models.CharField(max_length=255, blank