Jump to:

5554 Posts in 1742 Topics by 1227 members

Customising the CMS

SilverStripe Forums » Customising the CMS » ModelAdmin error : "The action 'admin' does not exist in class MyClass"

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

Page: 1
Go to End
Author Topic: 1284 Views
  • VRoxane
    Avatar
    Community Member
    42 Posts

    ModelAdmin error : "The action 'admin' does not exist in class MyClass" Link to this post

    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 ?

  • merrick_sd
    Avatar
    Community Member
    95 Posts

    Re: ModelAdmin error : "The action 'admin' does not exist in class MyClass" Link to this post

    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
  • VRoxane
    Avatar
    Community Member
    42 Posts

    Re: ModelAdmin error : "The action 'admin' does not exist in class MyClass" Link to this post

    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 !

    1284 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.