wagtail

is it possible to use class based view instead of function based view wagtail?

本小妞迷上赌 提交于 2019-12-13 02:26:33
问题 i'm still struggling to integrate django wagtail to an existing project. i'm only using wagtail for my blog page. and i want to create a form to create new post for my blog from my wagtail page. the way i create this is using an routablepage. here's some of my code i'm using this as my reference models.py class BlogIndex(RoutablePageMixin, Page): ... @route(r'^send-post/$', name='send_posts') def submit(self, request): from .views import submit_news return submit_news(request, self) ... class

Custom URL for Wagtail model

。_饼干妹妹 提交于 2019-12-12 21:38:53
问题 I have a model like this: from wagtail.wagtailcore.models import Page class Blog(Page): created = models.DateTimeField(auto_now_add=True) ... .. Right Now, my default, if my slug is hi-there , the blog post is accessible on site_url:/hi-there/ but I want it accessible via site:url/2014/02/05/hi-there/ The page has various methods like url, url_path which one should I override and what's the best practice to achieve something like this in wagtail? 回答1: The RoutablePageMixin is the current (v2

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

Django Wagtail CMS migrate: Cannot resolve bases for [<ModelState: 'app.CustomPage'>

放肆的年华 提交于 2019-12-12 10:12:05
问题 I have problem migrate simple app, bases on Wagtail CMS. Traceback after runing python manage.py migrate : Rendering model states...Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/yanik/oasis/oasis/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line utility.execute() File "/home/yanik/oasis/oasis/venv/local/lib/python2.7/site-packages/django/core/management/

How to access ManyToOneForeignKey data without making extra queries in Wagtail(django)

半世苍凉 提交于 2019-12-12 03:46:53
问题 I have the following two classes in my app.models and i'm using the wagtail APIs to get the data as json class States(Page): name=models.CharField(max_length=50) class Cities(Page): def get_state_name(self): return self.state.name name = models.CharField(max_length=50) state = models.ForeignKey(States, related_name='related_cities' ) state_name = property(get_state_name) So, when I try /api/v1/pages/?type=dashboard.States&fields=name,related_cities, it returns the following data: { "meta": {

How to list wagtail pages in Django template?

◇◆丶佛笑我妖孽 提交于 2019-12-11 15:00:48
问题 I have a site that is mostly made with Django but has a few content pages that need to be managed by Wagtail. How can I link to the pages created with Wagtail in Django templates? I don't want to have to hardcode any of the pages. The client should be able to make a page in Wagtail and a link should be created to that page in Django templates. The problem is that I don't know how to reference Wagtail pages through Django templates. 回答1: When you say reference Wagtail pages through Django

Is there a file size limit or extension limit in wagtail?

旧城冷巷雨未停 提交于 2019-12-11 14:20:21
问题 I have a very simple model (Product) which is used as an InlinePanel in a page. Product has a FileField which works fine as long as I upload small files, but as soon as I upload a large file (>5MB), I somehow get an CSRF error. Both on local and on production. It is not an issue with nginx max upload size. Is there a file size limit or extension limit in wagtail? 回答1: Yes, this comes baked into wagtail. If you add the following setting to your settings.py (or whatever your main settings file

Error when previewing Wagtail page and getting related inlines

馋奶兔 提交于 2019-12-11 12:57:39
问题 I'm getting errors when previewing Wagtail pages, but they're fine when published and viewed live. My set-up is something like this: from django.db import models from modelcluster.fields import ParentalKey from wagtail.core.models import Orderable, Page from wagtail.snippets.models import register_snippet @register_snippet class Author(models.Model): name = models.CharField(max_length=255, blank=False) class ArticleAuthorRelationship(Orderable, models.Model): author = models.ForeignKey(

Redirect to delete view in Django admin

老子叫甜甜 提交于 2019-12-11 11:55:36
问题 I'm working on a Django/Wagtail project. I have a very customized feature in the admin view what will delete an object when hitting Save if certain conditions are met. I have this in my class (that is a snippet): def save(self, *args, **kwargs): if condition: self.delete() else: return super(MyModel, self).save(*args, **kwargs) This works as expected. The object gets deleted, but after this I get an error page because the browser remains in the same URL /snippets/myapp/mymodel/1234/ but the

Wagtail: Deployment Issue - KeyError 'request' on /admin

我与影子孤独终老i 提交于 2019-12-11 10:22:28
问题 I'm deploying a site using Wagtail CMS on a webfaction server. When I try to go to www.mysite.com/admin (wagatil admin interfase) it give me a 500 error. I can go to django's admin with no problem. I looked at the server logs and what it says is the it raise a KeyError for the 'request' key. This happens only when Debug is True, I changed it to False and the /admin was rendered correctly. I verified that the 'django.core.context_processors.request' is added in the TEMPLATE_CONTEXT_PROCESSORS