CMS user cannot see "add child page" button - wagtail

I am trying to use Wagtail within a pre-existing Django project. I have installed the CMS, and it seems to be working well within the existing Django admin - I can authenticate using one of Django admin's users and see the CMS UI, all good.
But: No matter what I try, as an admin user, I cannot see the "Add Child Page" button at the URL of the page e.g /cms/pages/3/. The "Add Child Page" lozenge icon does not show. This is a bit of a pain, because all tutorials and examples assume that this icon is already showing!
The user I am logged-in as is set as "is_superuser" = 't' in auth_user, and one of the two groups the user is in, has been granted ALL wagtail permissions within Django admin (I was desperate!), but still no dice. I've also tried giving ALL perms to other (non-admin) users, and logging-in as them, but still cannot see the button.
I have created a basic HomePage that subclasses Page and I still see no way to create one. delving deeper, I see that one of the user's groups (auth_group.id=1) has the "add" permission in "wagtailcore_grouppagepermission" for the page I am viewing in the CMS which appears correct.
I am new to Python/Django, so I may have missed something obvious!
Django 2.2
Wagtail 2.8.1
CentOS
Python 3.6
(Docker multi-service setup through docker-compose using CentOS)
[UPDATE]
I can see that the following line is failing the test for specific_class being anything other than None. If I hack the line to return True, I see the button in the CMS UI:
./core/models.py:
def can_add_subpage(self):
...
if specific_class is None or not specific_class.creatable_subpage_models():
print('##', specific_class) # None
return False
...
Why would specific_class be None? What exactly is specific_class?

Take a look at the subpage_types declaration: https://docs.wagtail.io/en/latest/reference/pages/model_reference.html?highlight=parent_page#wagtail.core.models.Page.subpage_types
Also see parent_page_types below that.

Related

2sxc "had an Error Talking with the Server (Status 403)"

I installed a 2sxc version 11.11.3 Inside a fresh dnn 9.3.2.
After this I created a content Module with the simple test view inside. After this I granted this module the edit permission to the Registered Users Group on dnn module Level.
If I log in as a registered user I can see the 2sxc toolbar (blue symbols when hovering the item of the module) of the Module and the items. If I press the edit icon I get the Message "had an Error Talking with the Server (Status 403)".
Has anyone an idea what I am doing wrong?
Thank you very much
Robert
Edit1
The browser console shows following content in the ERROR object:
error: "Permission denied. required permissions for this request are not given"
headers: t
lazyInit: ƒ ()
lazyUpdate: null
normalizedNames: Map(0) {}
__proto__: Object
message: "Http failure response for https://.../api/2sxc/cms/edit/load?appId=2: 403 OK"
name: "HttpErrorResponse"
ok: false
status: 403
statusText: "OK"
url: "https://.../api/2sxc/cms/edit/load?appId=2"
Edit2
After this I wanted to explore, if the behavior is 2sxc Content module related or if it is related to all apps (in my understanding the 2sxc Content module is an app too). I installed the "FAQ" app, granted the dnn "Edit" permission to the "Registered users" group and logged in as a registered user and pressed the edit icon on the 2scx toolbar - and had the same behavior like described in the origin post.
But: I got it running for the "FAQ" app, but not for the "Content" app. Here are my steps to get it running for the "FAQ" app:
click on "Apps management" (available in the dnn edit action or in the 2sxc toolbar)
"Features" - add feature - enable "Permission by Group / Role" - Activate feature
"Apps" - "FAQ" (or another except Content)
"App" - "App Permissions" (click on the icon) - "create new permission" - Identity=xx (xx=RoleId of the Group in table dbo.Roles) - Grant=Edit (in my case I want that the current registered user is able to edit an item) - Save (Ctrl+S)
After this I was able to edit the item of the "FAQ" module.
The "App Permissions" icon is disabled by default for the "Content" module on App level (and on view and data level too). Does anyone know if this is by design or is there a possibility to activate this option? Otherwise I have to migrate my content views to an app to get the permissions running.
Edit3
I ended up by migrating the content of the "Content" app to a new custom app. The effort is very less and getting the possibility to grant permissions was worth doing it.
In a conclusion I'll answer my question by myself. I suppose that the "Content" app has not the possibility granting the dedicated permissions. But the app itself has the posibility - so it could be a good idea, to create content inside an app.
Just some background: The content-app is meant for simple content and behaves differently from normal apps. Example:
when you add a content-app, the dialog asks for you to choose what content-type, and what view
when you add an app, the dialog asks you for which app, and then what view
Basically the content-app has various optimizations to make it lighter and simpler, but we wanted to prevent people from "shooting themselves in the foot" because they will usually start with content, and then make it increasingly complex (never separating different concerns) and end up with a big mess.
This is why the content-app has some forced limitations (like no app-permissions) to guide people to place more complex functionality in own apps.
Now note that this doesn't explain your original issue: apparently edit-permissions didn't work as expected. That seems to be a bug, not an intension. If you think that should be followed up, best create an issue on github.

Make logged-in author user in wagtail

This seems like a really simple requirement for a blogging app or CMS:
How do you automatically make the logged-in user the author of a wagtail page? For example, if I log in as "Bob" and type a post, the author should automatically be "Bob".
Normally I would simply write it into my Django views but since I'm using Wagtail I expect it to be in the main package. However, the docs don't mention it, and the official demo seems to imply that authors must be chosen from a dropdown select box, which means any author can pretend to be anyone else!
We access the People object with an inline panel that references the
ParentalKey's related_name in BlogPeopleRelationship.
Is there a feature I've missed?
The user who created a page is available as the property owner:
http://docs.wagtail.io/en/stable/reference/pages/model_reference.html#wagtail.core.models.Page.owner
This is used within Wagtail for permission checks (a user with 'add' but not 'edit' permission can edit pages that they have created themselves), but it can also be displayed on your site front-end as the page author if you so desire.

Wagtail Admin UI: create HomePage without a Site leads to AttributeError crash

I'm new to Wagtail, and I'm exploring the Bakery demo [that is a great demo, by the way!]. I can produce an AttributeError, 'NoneType' has no attribute 'startswith'".
The problem is that the Preview code in the Admin UI assumes that there is a site for every Page. But in my case there is no site yet.
I got to this point by not paying enough attention to the warnings in the Admin UI. But still, a little defensive programming in the Wagtail admin code will protect against this error.
Steps to reproduce:
Get the Bakery demo up and running.
Wonder about creating my own site, as a sibling of the Bakery site. Note the absence of a 'Sites' entry in the Admin UI sidebar, and decide to create a new HomePage thing via Pages -> Add child page (to Root) -> select HomePage as the type of the new child of Root.
Read this warning, but pay no attention: "These is no site set up for this location. Pages created here will not accessible at any URL until a site is associated with this location. Create a site now"
Create a new HomePage thing.
Click "Preview".
Uh-oh.
The problem is that the Preview code in the Admin UI assumes that there is a site. But in my case there is no site yet.
It seems to me that the code that does the Preview operation can check in advance for an associated Site. Or perhaps the code can catch the AttributeError and compose an error response of its own.
Moved to github, as suggested by gasman. I apologize - I misread the wagtail.io website about where to get support.

Dotnetnuke 6 Ribbonbar Admin and dropdown gone

Above is the ribbonbar after I have logged in as a super user. The Admin option next to Host is completely gone
The site is running DNN6, the skin is only in the site portal folder, and it seems that all admin modules and options have gone away. Even the header, which I set in Site Settings (under Admin), went away!
Has anyone else had their admin options completely disappear on them? Is it possible that the skin is messing it up (all other sites use the same _default menu files and they work fine)?
Thanks for any replies.
We've recently had this exact situation occur in one of our DNN sites. It turn out that one of the site's administrators had accidentally renamed the Admin page from within the "Page Management" section (it's easy to see how that could happen). The fix was to go directly to /Admin/Pages.aspx and change the "Page Name" back to "Admin" ... and it will show up in the ribbon bar again.
As a suggestion to DNN developers, I would recommend making the Admin page and its subpages impossible to rename....
Can you check the database to see if those pages exist? What if you try to navigate to http://website/admin.aspx do you see the admin page and all the child pages there?

Cakephp: cannot login if using a theme

I am not a newbie cakephp developer however I won't call myself as an intermediate level cakephp programmer.
I came across a strange behavor what I could not handle.
I've build up an app with default views. First customer needs themeing so I decided to use the cakephp theme feature and started to make a theme with views, layouts etc.
I am using cakephp 1.3.8.
Everything works fine except I can't log in. Cakephp redirects me to an impossible place, the search controller with search results. It simply could not happen.
With the default views everything works fine.
What could be the reason? Could it be a bug in Auth component? Where should I start to debug this and how?
Thanks.
edit:
I made a copy of my default views into a new theme, and changed the $theme variable to this new theme. Everything works, so Auth and Theme facilities are fine, the reason should be my first theme. How a theme, or view file affects on login processing and/or Auth redirections? I still do not know how to find the bug in my views :(. I've set debug to 2, also checked the logs in tmp/logs but there ares now infos. Any idea?
SOLVED
I found the problem, a $this->Form->end() was missing from the searchbox element so the login data was submitted to the products controller search method, therefore the login wasn't processed.
Was my fault.

Resources