Oracle APEX - ORA-02290: check constraint (APEX_220100.WWV_FLOW_TEMP_OPT_NAME_CK) violated - oracle-apex

I am getting a check constraint error when adding a template option.
I made a copy of the Inline Dialog template and wanted to add a different option for size and gotten this error.
I selected the options below:
Group: Size
Display name: X-Small(400x260)
CSS classes: js-dialog-size400x260
What am I missing? Should I have pre-defined the class for js-dialog-size400x260

Related

Change Default Homepage When Adding Wagtail to an Existing Django Project

I followed the instructions from the Wagtail site for adding Wagtail to an existing Django project. At the end of the instructions, it said:
Note that there’s one small difference when not using the Wagtail project template: Wagtail creates an initial homepage of the basic type Page, which does not include any content fields beyond the title. You’ll probably want to replace this with your own HomePage class - when you do so, ensure that you set up a site record (under Settings / Sites in the Wagtail admin) to point to the new homepage.
I would like to change the 'basic type Page' to my model class BlogIndex. I know I can add the BlogIndex as a subpage of the default one and then point to it as described in the instructions. Instead, I would like to change the existing page. It bugs me having an unused page at the root. It would be a cleaner approach just to use it.
After adding my new class and migrating it, the django_content_type table looked like this:
1,admin,logentry
2,auth,permission
3,auth,group
4,auth,user
5,contenttypes,contenttype
6,sessions,session
7,wagtailcore,page
8,wagtailadmin,admin
9,wagtaildocs,document
10,wagtailimages,image
11,wagtailforms,formsubmission
12,wagtailredirects,redirect
13,wagtailembeds,embed
14,wagtailusers,userprofile
15,wagtailimages,rendition
16,wagtailimages,uploadedimage
17,wagtailsearch,query
18,wagtailsearch,querydailyhits
19,wagtailcore,grouppagepermission
20,wagtailcore,pagerevision
21,wagtailcore,pageviewrestriction
22,wagtailcore,site
23,wagtailcore,collection
24,wagtailcore,groupcollectionpermission
25,wagtailcore,collectionviewrestriction
26,taggit,tag
27,taggit,taggeditem
28,blog,blogindex
There is another table: wagtailcore_pages that contains three rows:
1,0001,1,1,Root,root,true,false,/,"",false,"",,,false,7
3,000100010001,3,0,Blog Index,blog-index,true,false,/blog/blog-index/,"",false,"",,,false,28
2,00010001,2,1,Welcome to your new Wagtail site!,home,true,false,/blog/,"",false,"",,,false,7
The last column is the content_type_id, which maps to the table above. I tried changing the value from 7 to 28. When I went to access the page in Wagtail admin, I got the error:
DoesNotExist at /cms/pages/2/
BlogIndex matching query does not exist.
Request Method: GET
Request URL: http://localhost:8006/cms/pages/2/
Django Version: 3.0.7
Exception Type: DoesNotExist
Exception Value:
BlogIndex matching query does not exist.
Exception Location: /Users/curt/htdocs/zetcho/venv/lib/python3.8/site-packages/django/db/models/query.py in get, line 415
Python Executable: /Users/curt/htdocs/zetcho/venv/bin/python
Python Version: 3.8.2
This happened before and after I added the the BlogIndex page that you see in the wagtailcore_pages. Both were after I ran the migration to add it to the model. When I change it back to 7, everything is back to normal. My guess is that it's looking for the model in the wrong place.
I then created a standalone Wagtail app to see how it was different. The start of django_content_type table looked like this:
1,wagtailcore,page
2,home,homepage
3,wagtailadmin,admin
The app_label 'home' is the name of the app that the wagtail process created. The home app has a model file with a HomePage class in it.
The wagtailcore_pages for the stand alone app contains two rows:
1,0001,1,1,Root,root,1,0,/,"",0,"",,,0,1
3,00010001,2,0,Home,home,1,0,/home/,"",0,"",,,0,2
It's interesting that the id for the second row is 3 (the first column is id). Given the field is auto increment, a row with the id 2 must have been added and then deleted. The only thing I did after the migration to do runserver to insure it worked.
Clearly, I'm missing another step or two to get it to work assuming that's even possible. Any idea what they might be?
There's a two or three year old ticket on the Wagtail site regarding the setting of the default page, but on solution.
Update
I attempted what I understood to be #gasman's solution. The wagtail_core_page now looks like this:
1,0001,1,1,Root,root,true,false,/,"",false,"",,,false,7
5,000100010001,3,0,Blog Index,blog-index,true,false,/blog/blog-index/,"",false,"",,,false,28
2,00010001,2,1,Welcome to your new Wagtail site!,home,true,false,/blog/,"",false,"",,,false,28
The only change here is setting the page type for the second row to 28. I also changed the blog_blogindex table to this:
2,<p>Introduction</p>
The first column had been five. I've added and deleted a few times, thus the five. I stopped and restarted the application and got the following error when I added /cms to the url:
KeyError at /cms/
5
Request Method: GET
Request URL: http://localhost:8006/cms/
Django Version: 3.0.7
Exception Type: KeyError
Exception Value:
5
Exception Location: /Users/curt/htdocs/zetcho/venv/lib/python3.8/site-packages/wagtail/core/query.py in specific_iterator, line 403
Python Executable: /Users/curt/htdocs/zetcho/venv/bin/python
Python Version: 3.8.2
My guess is because I still have the third row in the wagtail_core table above. I had that row in order to get a row to appear in the blog_blogindex table. I next tried to delete the row with the five in it and got a postgre/SQL error:
[23503] ERROR: update or delete on table "wagtailcore_page" violates foreign key constraint "wagtailcore_pagerevi_page_id_d421cc1d_fk_wagtailco" on table "wagtailcore_pagerevision" Detail: Key (id)=(5) is still referenced from table "wagtailcore_pagerevision".
After realizing I misread #gasman's clearly worded response, I added a second row to blog_blogindex:
5,<p>Introduction</p>
2,<p>unused page</p>
There only needs to be the one entry: the second one. I changed the seven to 28 in the wogtailcore_page for the row created as part of the setup. Wagtail ran without errors and the default page is using the BlogIndex class.
I had an additional problem: the site row was deleted. I'm pretty sure that was a result of me deleting the page to which it was pointing. I had changed the default home page in settings. I just added the row back and I was good. I should have changed the site row back first.
The Fix
Add Wagtail to your project following the Wagtail instructions
Add a model class for the home/base page you wish to use. I set mine up in a separate app.
Run makemigrations and migrate.
You should back up your database at this point in case things go horribly wrong in the next steps. You will be manually changing table data.
Access the database and add the row to the new created class table as described by #gasman.
Change the content_type_id column in wagtailcore_page of the second row to the id of the newly create class. There should only be two rows with the first one being the root. You can find the id in the django_content_type table.
Commit your changes and run your app.
The missing step is to create an entry in the blog_blogindex table with page_ptr_id=2, to accompany the wagtailcore_page record. Wagtail uses multi-table inheritance for Page objects, so the data for a BlogIndex instance is split between wagtailcore_page (which contains the fields common to all Page models) and blog_blogindex (which contains the fields defined on BlogIndex specifically).
However, I'm not aware of any way to create a blog_blogindex entry through the Django ORM as a standalone operation - if you try it, it will attempt to create a new wagtailcore_page entry at the same time. The 'home' app in the standalone project works around this (in the 0002_create_homepage migration) by deleting the old Page instance and creating a HomePage to replace it (creating entries in both wagtailcore_page and home_homepage) - this results in the missing ID 2. If you really wanted to avoid this deletion/recreation step in your own app, you'd presumably have to create the blog_blogindex entry with a raw SQL INSERT query.

Error with Create Custum Template in Jama

I have an error while using Jama software to create a custom report template.
One resource is the Jama User Guide: http://help.jamasoftware.com/
Custom Report Development->Office Template Reports ->Building Custom Office Export Templates
The above page in the jama support webpage explains the process.
This guide directs to open the Export button, click 'Upload Template', and then browse the computer for the file. Any file selected for upload give sthe following error:
Unable to get property 'getValue' of undefined or null reference
I have downloaded the original Word Template and attempted to upload it again unchanged, but get the same error. This makes me assume that the template files are valid, but something is perhaps wrong with the upload process.
On various websites, I have seen other questions with the same error, but none on the Jama software specifically, and none with a solution that I was able to apply.
My question is what does this error mean, and how to upload a valid report to Jama.
Thanks
Image 1 shows Error message with Choose Template page in background
The error means that you try to call getValue of a null object, so search for
.getValue
and check out which objects are null. If you have foo.getValue(), then there is a chance that foo is null. Make sure that it is either not null, or you do not call its getValue if it is null or you properly handle the error potentially arising from the case.
This turned out to be a permissions issue. The permissions weren't set up yet, so Jama apparently submitted a null value in place of the intended file.

How to solve Sitecore Glass Mapper duplicate field names

I've a template with sections below:
Section A
Title
Name
Section B
Title
Name
Looks good on Sitecore. However when TDS Glass mapper generates the code, it generates Title and name twice.
Wondering if it's possible to add the section name before each field when glass mapper generates the code.
If you ask me why, it's to avoid 248 character length error for windows file system for TDS items as I had done this as work around.
Section A
Section A Title
Section A Name
Section B
Section B Title
Section B Name
Any help will be awesome.
Thanks.
It is generally not good practice to have Fields with the same name defined multiple times in the same template. Although Sitecore will allow you to do that and will be able to identify the fields separately by the Field ID - Most code uses field names or generated code to do that. When referencing the fields by name, it will fail.
You have 2 options.
Option 1
It is better practice to either prefix the names or come up with a unique naming convention, as you have done in your example
Option 2
As an alternative you could modify the T4 template to prefix the field names when generating the code, with the section name. This would allow the code to compile. But depending on how the fields are being mapped by Glass (normally this is by field name, not ID) - it will still cause issues as Sitecore will not know which field to use.
I would go with Option 1

Hello World for Rules and Actions in Sitecore

I am learning sitecore Rule and readthe material on Rule Engine Cook Book. I just want to show a message window on Item save. This is what I did so far:
Added a Rule under /sitecore/system/Settings/Rules/Item Saved/Rules.
Rule 1:
where the item template is Address entry
run Show Hello World script
Added a script Show Hello World under /sitecore/system/Settings/Rules/Item Saved/Actions/
in the script there are 3 fields which I need to fill as the cookbook says, Enter a value in the Type field, or a value in the Code, References, and Language fields. Do not enter values in all four fields. Therefore I filled the fields with following data:
code: Sitecore.Context.ClientPage.ClientResponse.Alert("More than one address not allowed under this item!");
References: I don't know what to write here.
Language: CSharp
I don't know what I am doing wrong here. Any help would be really appreciated!
I've just successfully recreated your script and tested it on a fresh Sitecore instance. Here are the steps you must follow:
Add a new item of the template type /sitecore/templates/System/Rules/Script under /sitecore/system/Settings/Rules/Definitions/Elements/Script. I called my item "mydemoscript". If you are running an earlier version of Sitecore (I think 7.2 or earlier) then your save path will be /sitecore/system/Settings/Rules/Item Saved/Actions
In the script's Code field add the following:<%Sitecore.Context.ClientPage.ClientResponse.Alert("More than one address not allowed under this item!");%>
In the script's Type field add "CSharp"
Save your script item.
Under /sitecore/system/Settings/Rules/Item Saved/Rules create a rule, I named mine "mydemo"
In the Rule field use the same condition as you did before. For the action use "run specific script" action. Be sure to edit the action to refer to the script that you created in steps 1-4.
Test!
I don't think I've ever seen code field being used in Actions item.
The easiest way of executing some code on action is using the Type field with value:
My.Assembly.Namespace.MyCustomAction,My.Assembly
And then MyCustomAction class code:
using Sitecore.Data;
using Sitecore.Rules.Actions;
namespace My.Assembly.Namespace
{
public class MyCustomAction<T> : RuleAction<T> where T : ConditionalRenderingsRuleContext
{
public override void Apply(T ruleContext)
{
// your code here
}
}
}

Sitecore field for selecting link from folder structure defined by author

Working on a Sitecore 6.6 build I'm allowing authors to create items with the following structure:
AAA
BBB
CCC
CCC
BBB
CCC
CCC
Here AAA, BBB, CCC are different templates. Notice that AAA allows items of BBB or CCC, and BBB only allows CCC.
I now require a link field on a template with source root set to AAA, where the author may only select a single item of template CCC. But crucially I want the 'folder' structure (defined by BBB) to be preserved visually.
I can't use a DropLink because the item list is flattened.
As far as I can tell I can't use a DropTree because I can't stop the author selecting items of type BBB.
If I was offering a multi-select I could use a TreeList with a DataSource and work with its paramters (ExcludeTemplatesForSelection etc). But I only want a single item selected.
It would appear that Grouped DropLink is exactly what I'm looking for but it appears to be buggy. I may be misunderstanding though so your guidance would be much appreciated. The query below looks correct to me but presents a strange list of options where some items of BBB are selectable.
query:/sitecore/content/home/AAA//*[##templateid='{CCC}']
Help much appreciated.
I would go for the Treelist (or even TreelistEx) as you suggested, but use a custom validator on the field where you specify that the field can only contain 1 guid. Make the error level high enough so non-admin users can't save the item when the field value is faulty. FatalError would be your best bet.
ValidatorResult.CriticalError // The validator resulted in a critical error. The user will be warned before saving.
ValidatorResult.Error // The validator resulted in an error.
ValidatorResult.FatalError // The validator resulted in a fatal error. The user cannot save before the error has been resolved.
ValidatorResult.Suggestion // The validator resulted in a suggestion.
ValidatorResult.Unknown // The validator has not yet evaluated.
ValidatorResult.Valid // The validator has evaluated and is valid.
ValidatorResult.Warning // The validator resulted in a warning.
I would try to adjust your query to the following:
query:/sitecore/content/home/AAA//*[##templateid='{CCC}'][##templateid!='{BBB}']
I know that it is redundant, but I would give it a try and see what happens. Regardless, you should open up a Sitecore support ticket for the issue.