Make logged-in author user in wagtail - 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.

Related

Salesforce Knowledge Article Field - Not Visible to Guest User

I am very new to Salesforce, so apologies if my use of terms is not correct.
I am using Lightning Knowledge
I have enable and setup Knowledge Base and added FAQ articles and have added Question and Answerr fields to those articles.
I have setup the field visibilty so they are visible to all user including "Read Only" users (I could not find anything specific for Guests, should there be?)
So as far as I can tell the field permissions on the Question and Answer fields is correct.
I create articles and enter my values for my "Question and Answer fields" but when I go to my public site to view the FAQ, I only see the content of the Title and URL Name fields. I do not see my Question and Answer Fields.
If I login and view the articles via the public site, I do see the Question and Answer values.
I would very much appricaite it if anyone could point me in the right direction for trying to figure this out. I have googled but cannot seem to find anything that talks about guest users and field visibilty that has helped me.
Many Thanks
Derek
Yes, guest user is still an user. There's hidden user account (which acts as "created by" when you make new Case for example) and Profile which you might have to edit. It doesn't show up on normal list of profiles (but for example the Id can be queried and once you know Id you could construct the url yourself).
If you're using an Experience Cloud (aka Community) go to your site's Builder and the links will be at the bottom.
If you're using Sites - it should be in Site's config.
I had the exact same issue, but did see the solution documented in the previous comments.
In your community navigate to Settings
Select General
Click link under Guest User Profile
Scroll down to Field-Level Security
Click View for Knowledge
Click Edit
Check the Read Access box for the fields which are not displaying
Click Save

CMS user cannot see "add child page" button

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.

How do I link a Wagtail custom form to its output?

When a custom form is created in Wagtail, I can see that it stores in the DB. What I'm not clear on is how to make it so that the admin UI contains the results in some manner. (A new link which lets you download a CSV would be fine, but I don't see how to do that)
How do I allow admin users the ability to see the results of the custom forms? Is this library the only way?
Once you create your first form page (i.e. a page of any page type that subclasses AbstractForm), a 'Forms' item will automatically appear in the left menu of the Wagtail admin. This provides a listing of all the form pages that exist on the site, allowing you to access the results of each one and download them as a CSV.

How to create different registration form in Drupal7 when anonymous user can't view published pages?

To resolve this problem on my own, I started out by installing Profile2 and Profile2 registration. At no point was I able to generate a page based on the user name (eg, {domain}/private/register). I figured it was not coming up b/c I checked off that anonymous users could not see published pages (which is a site requirement). However, I might have done something wrong but I went over the instructions several time and I don't think I made a mistake. Any suggestions would be helpful.
I think you may have to create a new content type, similar to the normal story or article types, and publish restricted content as the new page type. Apply the access restriction to this content type, and leave the default content types alone.

Disable Drupal 7 fivestar widget after vote is done

Co's,
I am a newbie to drupal. I am using Drupal 7,fivestar,userpoints and voting rules modules in my intranet site. I created new rules by using the Rules module to award points to the content author based on the rating ( no of stars etc) provided by the logged in users. This is working fine.
But the problem is , whenever the logged in user clicked the fivestar widget, an event fires and the content author getting points based on the rules defined.
To resolve this, I want to disable the fivestar widget after the logged in user clicked the fivestar widget once.
How can we make it ? Could you please suggest how to achieve this ?
Version details for the modules i am using are below.
Fivestar 7.x-2.0-alpha2
Voting API 7.x-2.6
Userpoints 7.x-1.0
Voting Rules 7.x-1.0-alpha1
Rules 7.x-2.1
You must add a condition to the rule, something like "if user hasn't vote on the content yet". Probably you can achieve this just using the rules interface, otherwise you will have to do a little research on the fivestar api to verify users vote on a specific node.
Hope that helps!

Resources