wagtail

Using python 3.6 on azure app services - not working despite it is installed as extension

亡梦爱人 提交于 2019-12-04 17:13:43
I've got a challenge with deploying Django app (wagtail to be precise) to Azure Web Services using external Git repo (Bitbucket). I want to use Python 3.6.1, therefore I followed instructions at Managing Python on Azure App Service manual I have python 3.6.1 extension installed and in place I created web.config file in root directory of my app (I checked and it is uploaded to the server) However, deploy fails with message Detecting Python runtime from runtime.txt Unsupported runtime: python-3.6.1 Supported runtime values are: python-2.7 python-3.4 An error has occurred during web site

Wagtail per page user permission

岁酱吖の 提交于 2019-12-04 17:01:58
My task is to enable users to edit their own page. I see how to give permissions to a particular page to a group, but how do I do this for the user? I'd tried use django guardian: UserObjectPermission.objects.assign_perm('change_custompage', user, obj=custompage) but this wasn't given me results I also found the wagtailcore_grouppagepermission table and realized that the permissions principle is not the same as used in django auth_permission I want to give permissions to edit, and access wagtail admin, I do not need anything else In this particular task, wagtail I need because of the struct

Add StreamBlock child items programmatically in Wagtail

血红的双手。 提交于 2019-12-04 15:10:55
I have the following StructBlock and StreamBlock below: class AccordionItemBlock(StructBlock): title = CharBlock() text = RichTextBlock() class AccordionRepeaterBlock(StreamBlock): accordion_item = AccordionItemBlock() I need to programmatically add it and multiple "item" CharBlocks to this page: class BasicPage(Page): body = StreamField([ ('accordion_repeater_block', AccordionRepeaterBlock()), ], null=True) This is how I am approaching it page.body = [ ( 'accordion_repeater_block', { 'accordion_item', { 'title': 'Title goes here', 'text': RichText('Testing!'), } } ) ] provider.save() I get

Custom representation of Streamfield in rest API

狂风中的少年 提交于 2019-12-04 11:04:44
问题 I have a few questions about this thread: https://groups.google.com/forum/#!topic/wagtail-developers/Z4oaCIJXYuI I am building a headless Wagtail, with a React-based frontend, that calls Wagtail API in order to parse JSON and display content. Pretty basic. I was wondering if it was possible to custom the output of streamfield in rest API. A few examples: Get a image URL based on this example from wagtaildemo: https://github.com/wagtail/wagtaildemo/blob/api-tweaks/demo/models.py#L713-L716 (I

How to change django wagtail's admin logo

对着背影说爱祢 提交于 2019-12-03 13:34:48
I am working on a small project and I thought I'd give wagtail a try. I am now wondering how I could change wagtail's admin logo in the sidebar (top left image on the picture bellow). I could change /static/wagtailadmin/images/wagtail-logo.svg directly but it'd be wrong ;). Wagtail already provide the solution in the official documentation using django-overextends : To replace the default logo, create a template file your_app/templates/wagtailadmin/base.html that overrides the block branding_logo as follow: {% overextends "wagtailadmin/base.html" %} {% block branding_logo %} <img src="{{

Nested categories/InlinePanel(s) in wagtail

心不动则不痛 提交于 2019-12-03 08:35:44
I struggle to implement something like "nested categories": PageA: - Cat1 - SubCat1 - SubCat2 - ... - Cat2 - SubCat1 - ... All categories and subcategories should be orderable and editable by an editor. My guess was something like this: class CategoryTestPage(Page): content_panels = Page.content_panels + [ InlinePanel('categories') ] class Category(Orderable,ClusterableModel,models.Model): page = ParentalKey(CategoryTestPage, related_name='category') category = models.CharField(max_length=250) def __str__(self): return "%d %s" % (self.id, self.category) panels = [ FieldPanel('category'),

Custom representation of Streamfield in rest API

守給你的承諾、 提交于 2019-12-03 06:51:27
I have a few questions about this thread: https://groups.google.com/forum/#!topic/wagtail-developers/Z4oaCIJXYuI I am building a headless Wagtail, with a React-based frontend, that calls Wagtail API in order to parse JSON and display content. Pretty basic. I was wondering if it was possible to custom the output of streamfield in rest API. A few examples: Get a image URL based on this example from wagtaildemo: https://github.com/wagtail/wagtaildemo/blob/api-tweaks/demo/models.py#L713-L716 (I got it working for single URLs) PageChooserBlock: get a field from the targetted page As I read in the

Wagtail unit testing: Adding child pages converts them to base type

◇◆丶佛笑我妖孽 提交于 2019-12-02 18:38:03
问题 Trying to create some unit tests for Wagtail and running into the following problem: >> root = FrontPage.add_root(instance=FrontPageFactory.build()) >> root <FrontPage: article0> >> root.add_child(instance=ArticlePageFactory.build()) <ArticlePage: article1> >> root.get_tree() <PageQuerySet [<Page: article0>, <Page: article1>]> "article0" goes from being type ArticlePage to type Page in the page tree. Is this Page object a reference to the ArticlePage and there's a method I'm not aware of to

Wagtail unit testing: Adding child pages converts them to base type

≯℡__Kan透↙ 提交于 2019-12-02 09:40:59
Trying to create some unit tests for Wagtail and running into the following problem: >> root = FrontPage.add_root(instance=FrontPageFactory.build()) >> root <FrontPage: article0> >> root.add_child(instance=ArticlePageFactory.build()) <ArticlePage: article1> >> root.get_tree() <PageQuerySet [<Page: article0>, <Page: article1>]> "article0" goes from being type ArticlePage to type Page in the page tree. Is this Page object a reference to the ArticlePage and there's a method I'm not aware of to fetch it, or am I missing something obvious here? In the meantime I've worked around the problem by just

How can I add a form made by formbuilder to every page in Wagtail?

匆匆过客 提交于 2019-12-01 12:49:56
问题 Is there any way to add form (for example feedback form) to every page in CMS? I really like to use Wagtail FormBuilder so Editor guy can change fields. My first idea is to create custom form page (inherited from AbstractEmailForm) as site root child and load it to base.html trough template tag. I can access page properties this way but I cant render the form. Here is my template tag: @register.assignment_tag(takes_context=True) def get_feedback_form(context): return context['request'].site