Creating plugin for Django-CMS - database

I think I screwed up somewhere while trying to create a django-cms plugin and now I am unable to go back. The plugin (called sbbplugin) seems to be "working" (it gets displayed) but whenever I try to publish the site I get the following error:
DatabaseError at /admin/cms/page/18/publish/
relation "cmsplugin_sbbmodel" does not exist
LINE 1: ...id", "cmsplugin_sbbmodel"."cmsplugin_ptr_id" FROM "cmsplugin...
^
I tried removing the plugin but I can not do it because the page is not published. My plugin has no models or anything. Also I'm unable to remove the plugin from the page by clicking delete. Seems like the database is broken. Since I am not experienced enough to know what information you need I would appreciate it, if you could give me further instructions on what I should do.
Update: I think the problem is that I tried to use a model (sbbmodel) which I deleted. Should I try to add the model again? If so what should I do to fix the database? Do I have to run a migration for my app? Do I even have to register the plugin as an app?
Update2: So I tried to add the model again and migrate the app but I get the following error:
CommandError: One or more models did not validate:
sbbplugin.sbbmodel: Accessor for field 'cmsplugin_ptr' clashes with related field 'CMSPlugin.sbbmodel'. Add a related_name argument to the definition for 'cmsplugin_ptr'.
sbbplugin.sbbmodel: Reverse query name for field 'cmsplugin_ptr' clashes with related field 'CMSPlugin.sbbmodel'. Add a related_name argument to the definition for 'cmsplugin_ptr'.
S.sbbmodel: Accessor for field 'cmsplugin_ptr' clashes with related field 'CMSPlugin.sbbmodel'. Add a related_name argument to the definition for 'cmsplugin_ptr'.
S.sbbmodel: Reverse query name for field 'cmsplugin_ptr' clashes with related field 'CMSPlugin.sbbmodel'. Add a related_name argument to the definition for 'cmsplugin_ptr'.
which I do not really understand because I never specified a foreign key. I assume it is because I inherit from CMSPlugin. Any help?

I finally fixed it. First I removed every file that I created for my plugin. Then I deleted every instance of my plugin that was saved in the database. Unfortunately that did not solve the problem and I was still getting the same error even after restarting the server.
What did the trick was to go into phpPgAdmin and select all tables than choose "correct". It did not tell me what exactly the issue was but afterwards everything was back to normal again. So if you somehow run into the same problem, just "correct" your database automatically.

Related

Shopware 6 : [Error] Call to a member function getStorageName() on null

I want migrate some tables into Shopware 6 database. When I run this commande line
bin/console dal:create:schema
I get this error : [Error] Call to a member function getStorageName() on null.
How can I solve this bug ? Could you help me please ?
There's only one instance I can think of where this error might occur. It must be introduced by a plugin since this error would be caught before any release in the core.
There is a new EntityDefinition or EntityExtension (Definition A) which adds a ManyToOneAssociationField. The association references another EntityDefinition (Definition B). Definition B has implemented the isVersionAware method to return true. If definition A now misses to add a ReferenceVersionField for definition B as well, this is when the field to retrieve the storage name from would remain to be null, causing the error.
You can find the corresponding lines of code in the SchemaGenerator.
For a correct implementation you can find the OrderAddressDefinition which adds both a ManyToOneAssociationField, as well as a ReferenceVersionField for the OrderDefinition (which is version aware). If you were to remove the ReferenceVersionField you could reproduce this error without any plugins as well.
Either look at all the instances of EntityDefinition/EntityExtension within the plugins or try deactivating plugins one by one and try creating the schema again, until you find the plugin causing the error.

Sitecore - some items are missing in index after performing full index rebuild

We are facing an issue in our sitecore instance. When we perform full index rebuild in sitecore, we have noticed that some of the items are missing and they are not found throughout solr index. We have checked log files as well but no error traces are found. Then we tried publishing in web database i.e. Going to desptop --> Selecting web database from below --> publishing parent folders of the missing items and those items are available in the index again. Any suggestion or help will be much appreciated.
Thanks in Advance,
Lalit S. Joshi
There might be couples of reasons for failure some items while indexing. Please check the below points:
Check the crawling.log files and see any object reference error is thrown after complete the full index rebuilding.
Sometimes Event Queue table keeps growing in size and eventually getting flooded, so clear this one.
If you want to index every template, then do not include anything in the exclude Template section. If this is added, then those items will not be indexed. Even also check the field types of your template those needs to be indexed.
Check the security of the items or some conditions are there for that result, those items are might not be getting published properly.
Did you write any custom logic for e.g. computed fields for Solr index, check the log if they are throwing any error.
You didn't mention any specific error, so I have tried to mention some suggestion above. Hope this will help.

Grails 3 "show" view with Fields plugin 2.1.0-SNAPSHOT

Stuck at a trivial problem in Grails 3.1.5: Show the fields of a domain object, excluding one of them, including a transient property. Yes, this is my first Grails 3 project after many years with previous versions.
The generated show.gsp contains
<f:display bean="rfaPdffile"/>
This will include a field that may contain megabytes of XML. It should never be shown interactively. The display: false constraint is no longer in the docs, and seems to be silenty ignored.
Next I tried explicitly naming the fields:
<f:with bean="rfaPdffile">
<f:display property='fileName'/>
<f:display property='pageCount'/>
...
</f:with>
This version suprisingly displays the values without any markup whatsoever. Changing display to field,
<f:with bean="rfaPdffile">
<f:field property='fileName'/>
<f:field property='pageCount'/>
...
</f:with>
sort of works, but shows editable values. So does f:all.
In addition I tried adding other attributes to f:display: properties (like in f:table), except (like in f:all). I note in passing that those two attributes have different syntax for similar purposes.
In the Field plugin docs my use case is explicitly mentioned as a design goal. I must have missed something obvious.
My aim is to quickly throw together a prototype gui, postponing the details until later. Clues are greatly appreciated
If I understood you correctly, you want to have all bean properties included in the gsp but the one with the "megabytes of XML" should not be displayed to the user?
If that is the case you can do:
f:with bean="beanName"
f:field property="firstPropertyName"
f:field property="secondPropertyName"
And the one you don't wish to display:
g:hiddenField name="propertyName" value="${beanName.propertyName?}"
f:with
So list all the properties as f:field or f:display and put the one you don't wish to display in a g:hiddenField Grails tag
You can also try:
f:field property="propertyName"
widget-hidden="true"
but the Label is not hidden in this case.
Hope it helps
My own answer: "use the force, read the source". The f:display tag has two rather obvious bugs. I will submit a pull request as soon as I can.
Bugs aside, the documentation does not mention that the plugin may pick up the "scaffold" static property from the domain, if it has one. Its value should be a map. Its "exclude" key may define a list of property names (List of String) to be excluded. This probably works already for the "f:all" tag; bug correction is needed for the "f:display" tag.
My subjective impression is that the fields plugin is in a tight spot. It is intertwined with the Grails architecture, making it sensitive to changes in Grails internals. It is also required by the standard scaffolding plugin, making it very visible. Thus it needs constant attention from maintainers, a position not to be envied. Even now conventions for default constraints seem to have changed somewhere between Grails 3.0.9 and 3.1.7.
Performance of the fields plugin is sensitive to the total number of plugins in the app where it is used. It searches all plugins dynamically for templates.
For the wish list I would prefer stricter tag naming. The main tags should be verbs. There are two main actions, show and edit. For each action there are two main variants, single bean or multiple beans.
My answer is that at present (2 March 2017) there is no answer. I have searched the Net high and low. For the index (list) and create and edit views, the fields plugin works well enough. A certain field can be easily excluded from the create and edit views, relatively easily from the list view (by listing those that should show), and in no way I could find from the show view. This is such a common need that one would suspect it will be addressed soon. Also, easily showing derived values in the show view, like 'total' for an invoice. One can do that by adding an ordered list with a list item showing the value below the generated ordered list of values, but that is kind of a hack.
In some ways, the old way was easier. Yes, it generated long views, but they were generated and didn't have to be done by the programmer - just custom touches here and there.

Bugzilla: bugs are not showing up (show up in DB and everything seems to be fine)

I just installed Bugzilla locally and it seems that everything is fine. I can create new products and components. I can also file new bugs and they show up in the database.
But when I want to view them in the web interface, they won't show up.
Instead, at the top of the page this shows up:
Product: ARRAY(0x3735378 Component: ARRAY(0x4275650) Resolution: ARRAY(0x42755a8)
and then below the "Zarro Boogs found."
I couldn't find any information on that on the web, did anybody have similar issues? Thank you!
Please check the bugs table in techzilla database and verify if the bug details are getting updated.
The cgi file which corresponds to the listing of bugs is buglist.cgi.
Template file is:-global/message.html.tmpl
"Zarro Boogs found." is showing because, the values are not correctly entering in the query to display the buglist.
It is evident from the display,
Product: ARRAY(0x3735378 Component: ARRAY(0x4275650) Resolution: ARRAY(0x42755a8)
it is because of the looping problem.
check the display code in the template file or buglist file and correct the loop, then it will dsiplay properly
Jenifer,
Yes, It is because of the zero value in the query. We can check it, by printing the query and checking the value in DB.
Inserts a Named Query (a "Saved Search") into the database, or updates a Named Query that already exists..
We had similar problem. Bugs were not showing in search result list. The problem was in the name of the product when the name of the product was with diacritics (e.g. Czech, Slovak, etc...). When the name of the product is in US ASCII it is all Ok.

Trouble changing databases for my models in codeigniter

I'm making a website with two different databases. Let's say one is DB1, and the other is DB2. I've set up my database.php in the config folder, so they each have the correct host/password/username/database etc with db['DB1']['hostname'] and the other db['DB2']['hostname'] etc, so I'm pretty sure I've got that part right.
According to CodeIgniter docs, I'm supposed to do $this->load->database('DB1') to get that one to work within my model. First, I put it in my constructor for my model, and it didn't work. Then I tried putting that line as the first line of every function in the model, and that didn't work. I'm still getting this error:
Error Number: 1146
Table 'DB2.stores' doesn't exist
When I'm trying to use DB1, and have done $this->load->database('DB1') as the first line of the model's function. Does anyone know what I'm doing wrong? Thanks!
There are a couple of caveats I ran into when I last tried to do that.
In your model constructor, load DB1 and DB2 as
$this->DB1=$this->load->database('DB1',true) //<-- notice the true parameter
$this->DB2=$this->load->database('DB2',true) //<-- notice the true parameter
and then use $this->DB1->get()->where()->result_array() etc.etc.
Caveat 2
make sure persistent connections are off... they are on by default in CI
$db['DB2']['pconnect'] = FALSE;
and
$db['DB2']['pconnect'] = FALSE;
in your application/config/database.php file
hope that helps...

Resources