Commit 174b8e8f authored by Alex Pyrgiotis's avatar Alex Pyrgiotis

admin: Create folder for resources

Move the user/vm/project/... folders to a folder called "resources".
parent b053dbf5
......@@ -26,7 +26,8 @@ from django.contrib.auth.models import Group
from synnefo_admin.admin.exceptions import AdminHttp404
from eztables.views import DatatablesView
from actions import AdminAction, AdminActionUnknown, AdminActionNotPermitted
from synnefo_admin.admin.actions import (AdminAction, AdminActionUnknown,
AdminActionNotPermitted)
templates = {
'list': 'admin/group_list.html',
......
......@@ -26,7 +26,7 @@ from astakos.im.models import AstakosUser, Project
from synnefo_admin.admin.actions import (has_permission_or_403,
get_allowed_actions,
get_permitted_actions,)
from synnefo_admin.admin.users.utils import get_user_or_404
from synnefo_admin.admin.resources.users.utils import get_user_or_404
from synnefo_admin.admin.tables import AdminJSONView
from synnefo_admin.admin.associations import (
UserAssociation, QuotaAssociation, VMAssociation, VolumeAssociation,
......
......@@ -27,7 +27,7 @@ from astakos.im.models import AstakosUser, Project
from synnefo_admin.admin.actions import (has_permission_or_403,
get_allowed_actions,
get_permitted_actions,)
from synnefo_admin.admin.users.utils import get_user_or_404
from synnefo_admin.admin.resources.users.utils import get_user_or_404
from synnefo_admin.admin.tables import AdminJSONView
from synnefo_admin.admin.associations import (
UserAssociation, QuotaAssociation, VMAssociation, VolumeAssociation,
......
......@@ -27,7 +27,7 @@ from synnefo_admin import admin_settings
from synnefo_admin.admin.actions import (has_permission_or_403,
get_allowed_actions,
get_permitted_actions,)
from synnefo_admin.admin.users.utils import get_user_or_404
from synnefo_admin.admin.resources.users.utils import get_user_or_404
from synnefo_admin.admin.tables import AdminJSONView
from synnefo_admin.admin.associations import (
UserAssociation, QuotaAssociation, VMAssociation, VolumeAssociation,
......
......@@ -28,7 +28,7 @@ from astakos.im.models import AstakosUser, Project
from synnefo_admin.admin.actions import (has_permission_or_403,
get_allowed_actions,
get_permitted_actions,)
from synnefo_admin.admin.users.utils import get_user_or_404
from synnefo_admin.admin.resources.users.utils import get_user_or_404
from synnefo_admin.admin.tables import AdminJSONView
from synnefo_admin.admin.associations import (
UserAssociation, QuotaAssociation, VMAssociation, VolumeAssociation,
......
......@@ -26,7 +26,7 @@ from astakos.im.models import AstakosUser, Project
from synnefo_admin.admin.actions import (has_permission_or_403,
get_allowed_actions,
get_permitted_actions,)
from synnefo_admin.admin.users.utils import get_user_or_404
from synnefo_admin.admin.resources.users.utils import get_user_or_404
from synnefo_admin.admin.tables import AdminJSONView
from synnefo_admin.admin.associations import (
UserAssociation, QuotaAssociation, VMAssociation, VolumeAssociation,
......
......@@ -21,8 +21,8 @@ import logging
import django_filters
import synnefo_admin.admin.projects.utils as project_utils
import synnefo_admin.admin.users.utils as user_utils
import synnefo_admin.admin.resources.projects.utils as project_utils
import synnefo_admin.admin.resources.users.utils as user_utils
from synnefo_admin.admin import utils
mod = import_module('astakos.im.management.commands.project-show')
......@@ -249,7 +249,7 @@ def details_url(inst, target):
"""Get a url for the details of an instance's field."""
# Get instance type and import the appropriate utilities module.
inst_type = utils.get_type_from_instance(inst)
mod = import_module("synnefo_admin.admin.{}s.utils".format(inst_type))
mod = import_module("synnefo_admin.admin.resources.{}s.utils".format(inst_type))
# Call the details_href function for the provided target.
func = getattr(mod, "get_{}_details_href".format(target), None)
......
......@@ -17,7 +17,7 @@
#import logging
from astakos.im.models import Resource
from synnefo_admin.admin.projects.utils import get_project_quota_category
from synnefo_admin.admin.resources.projects.utils import get_project_quota_category
from .common import AdminTestCase
......
......@@ -22,7 +22,7 @@ from astakos.im.functions import remove_membership, enroll_member
from synnefo.db import models_factory as mf
from synnefo_admin import admin_settings
from synnefo_admin.admin.users.utils import get_suspended_vms, get_quotas
from synnefo_admin.admin.resources.users.utils import get_suspended_vms, get_quotas
from .common import AdminTestCase
......
......@@ -119,7 +119,7 @@ def get_actions(target, user=None, inst=None):
if target in ['quota', 'nic', 'ip_log']:
return None
mod = import_module('synnefo_admin.admin.%ss.actions' % target)
mod = import_module('synnefo_admin.admin.resources.%ss.actions' % target)
actions = mod.cached_actions
if inst:
return get_allowed_actions(actions, inst, user)
......
......@@ -64,9 +64,9 @@ def get_view_module(view_type):
if view_type in admin_settings.ADMIN_VIEWS:
try:
# This module will not be reloaded again as it's probably cached.
return import_module('synnefo_admin.admin.%ss.views' % view_type)
return import_module('synnefo_admin.admin.resources.%ss.views' % view_type)
except ImportError:
return import_module('synnefo_admin.admin.%ss' % view_type)
return import_module('synnefo_admin.admin.resources.%ss' % view_type)
return None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment