Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

ModelAdmin error : "The action 'admin' does not exist in class MyClass"


Go to End


3 Posts   1941 Views

Avatar
VRoxane

Community Member, 42 Posts

20 April 2011 at 3:28am

Edited: 20/04/2011 3:28am

Hi all ! Can somebody help me with this problem ?

Logbook is a class extending ModelAdmin.
It has two managed models : "Import" and "Export".

Thing is : Everything works fine with only one managed model active... only when I upload the other one and add it in Logbook, I can still show the "Logbook" tab but can't show/add exports or imports.
(There is also a weird margin around the cms window.)

I get this error :

 The action 'admin' does not exist in class LogBook

--> POST http://www.mywebsite.com/admin/logbook/admin/logbook/Import/SearchForm 404 Not Found 250ms

See how "admin/logbook" is repeated ?
I think that might be the result of the CMS trying to do something with the url, adding another "admin/logbook" by mistake... not considering it actually IS in "admin/logbook" already.

Any idea ?

Avatar
merrick_sd

Community Member, 99 Posts

6 July 2011 at 12:33am

i have similar thing code works on Silverstripe 2.3.7 but upgraded to Silverstripe 2.4.5 and doesn't work.

not sure if its a director rule that needs to be created. but i cannot seem to solve.

Director::addRules(50, array('admin/GlobalAdmin/$Class/$Action/$ID' => 'GlobalAdmin'));

Mysite>Code> GlobalAdmin.php
<?php
class GlobalAdmin extends ModelAdmin {

public static $managed_models = array(
'Footer','FooterIcon','Office', 'NavStyle', 'paypal_payment_info'
);

static $url_segment = 'Global'; // will be linked as /admin/products
static $menu_title = 'Global';

}
?>

in admin when i search a results page will come up but "not" withinthe admin the page will be a plain page listing results. and the links to edit or view record are formatted like

http://www.mydomainname.com/admin/Global/FooterIcon/admin/Global/FooterIcon/1/edit

Attached Files
Avatar
VRoxane

Community Member, 42 Posts

6 July 2011 at 12:55am

Hi merrick_sd,

Just so you know, I had to separate my Imports and my Exports to make it work (two different managed models).
I'll try again when I have some free time to do it.

Hope you'll manage to do what you want ! :)