'If no resource has been set lets automatically create a
REST tastypie model resource
The name defaults to the django model name (lowercase)
Set resource to False to do not create one'

def get_urls(self):

    from freenasUI.api.utils import APIAuthentication, APIAuthorization, DojoModelResource, DojoPaginator
    from freenasUI.freeadmin.navtree import navtree
    if ((self.resource is None) and self._model):
        if (self.resource_name is not None):
            resource_name = self.resource_name
        else:
            resource_name = ('%s/%s' % (self.app_label, self.module_name))
        myArgs = dict(queryset=self._model.objects.all(), resource_name=resource_name, include_resource_uri=False, always_return_data=True, paginator_class=DojoPaginator, authentication=APIAuthentication, authorization=APIAuthorization())
        mf = navtree._modelforms.get(self._model, None)
        if (mf and (not isinstance(mf, dict))):
            myArgs['validation'] = FormValidation(form_class=mf)
        '\n                                                For    models    that    represent    a    single    object    do    not    allow    create\n                                                neither    delete,    only    get    and    update.\n                                                '
        if (self._model._admin.deletable is False):
            myArgs['allowed_methods'] = ['get', 'put']
        myMeta = type('Meta', (object,), myArgs)
        mixins = [DojoModelResource]
        if (self.resource_mixin is not None):
            mixins.insert(0, self.resource_mixin)
            if hasattr(self.resource_mixin, 'Meta'):
                myMeta = type('Meta', (self.resource_mixin.Meta, myMeta), {})
        myres = type((self._model._meta.object_name + 'Resource'), tuple(mixins), dict(Meta=myMeta))
        res = myres()
        self.resource = myres
    elif ((self.resource is False) or (not self.resource)):
        res = None
    elif self.resource:
        res = self.resource()
    if res:
        v1_api.register(res)
    def wrap(view):
        def wrapper(*args, **kwargs):
            return self._admin.admin_view(view)(*args, **kwargs)
        return update_wrapper(wrapper, view)
    info = (self.app_label, self.module_name)
    if self._model:
        urlpatterns = [url('^add/(?P<mf>.+?)?$', wrap(self.add), name=('freeadmin_%s_%s_add' % info)), url('^edit/(?P<oid>.+)/(?P<mf>.+?)?$', wrap(self.edit), name=('freeadmin_%s_%s_edit' % info)), url('^delete/(?P<oid>.+)/$', wrap(self.delete), name=('freeadmin_%s_%s_delete' % info)), url('^empty-formset/$', wrap(self.empty_formset), name=('freeadmin_%s_%s_empty_formset' % info))]
    else:
        urlpatterns = []
    urlpatterns += [url('^datagrid/$', wrap(self.datagrid), name=('freeadmin_%s_%s_datagrid' % info)), url('^structure/$', wrap(self.structure), name=('freeadmin_%s_%s_structure' % info)), url('^actions/$', wrap(self.actions), name=('freeadmin_%s_%s_actions' % info))]
    return urlpatterns
