Merge branch 'develop'
diff --git a/xos/apigen/hpc-api.template.py b/xos/apigen/hpc-api.template.py
index 291403a..301346b 100644
--- a/xos/apigen/hpc-api.template.py
+++ b/xos/apigen/hpc-api.template.py
@@ -37,7 +37,7 @@
def get_hpc_REST_patterns():
return patterns('',
url(r'^hpcapi/$', hpc_api_root),
- {% for object in generator.all %}
+ {% for object in generator.rest_models %}
url(r'hpcapi/{{ object.rest_name }}/$', {{ object.camel }}List.as_view(), name='{{ object.singular }}-list'),
url(r'hpcapi/{{ object.rest_name }}/(?P<pk>[a-zA-Z0-9\-]+)/$', {{ object.camel }}Detail.as_view(), name ='{{ object.singular }}-detail'),
{% endfor %}
@@ -46,7 +46,7 @@
@api_view(['GET'])
def hpc_api_root(request, format=None):
return Response({
- {% for object in generator.all %}'{{ object.plural }}': reverse('{{ object }}-list', request=request, format=format),
+ {% for object in generator.rest_models %}'{{ object.plural }}': reverse('{{ object }}-list', request=request, format=format),
{% endfor %}
})
@@ -104,7 +104,7 @@
newModel = through(**{local_fieldName: obj, remote_fieldName: item})
newModel.save()
-{% for object in generator.all %}
+{% for object in generator.rest_models %}
class {{ object.camel }}Serializer(serializers.HyperlinkedModelSerializer):
id = IdField()
@@ -154,14 +154,14 @@
{% endfor %}
serializerLookUp = {
-{% for object in generator.all %}
+{% for object in generator.rest_models %}
{{ object.camel }}: {{ object.camel }}Serializer,
{% endfor %}
None: None,
}
# Based on core/views/*.py
-{% for object in generator.all %}
+{% for object in generator.rest_models %}
class {{ object.camel }}List(XOSListCreateAPIView):
queryset = {{ object.camel }}.objects.select_related().all()
diff --git a/xos/apigen/list.txt b/xos/apigen/list.txt
new file mode 100644
index 0000000..3e115e3
--- /dev/null
+++ b/xos/apigen/list.txt
@@ -0,0 +1,3 @@
+{% for o in generator.all %}
+{{ o.camel }}
+{% endfor %}
diff --git a/xos/apigen/modelgen b/xos/apigen/modelgen
index 7f740d1..8ae0afb 100644
--- a/xos/apigen/modelgen
+++ b/xos/apigen/modelgen
@@ -7,8 +7,7 @@
import json
import re
from django.template import Context, Template
-
-blacklist = ['SingletonModel','PlCoreBase']
+from optparse import OptionParser
# Django set up
@@ -16,6 +15,8 @@
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
from django.db.models.fields.related import ForeignKey, ManyToManyField
+options = None
+
def singular(foo, keys):
for k in keys:
if (foo==k+'es'):
@@ -40,7 +41,7 @@
for classname in dir(models_module):
c = getattr(models_module, classname, None)
- if type(c)==type(PlCoreBase) and c.__name__ not in blacklist:
+ if type(c)==type(PlCoreBase) and c.__name__ not in options.blacklist:
model_classes.append(c)
return model_classes
@@ -90,6 +91,10 @@
class Generator(dict):
def all(self):
return self.values()
+
+ def rest_models(self):
+ norest = [x.lower() for x in options.norest]
+ return [v for v in self.values() if not (str(v) in norest)]
def regex(self, r):
filtered = filter(lambda o:re.match(r,str(o)), self.values())
@@ -144,9 +149,9 @@
if (related_name.endswith("+")):
continue
- if (related_name!='+' and related_name.lower()!=str(obj).lower()):
- #print "XXX2", obj, f, related_name, related_model_name, refobj.plural_name
+ if (related_name!='+') and related_model_name in self: # and related_name.lower()!=str(obj).lower()):
refobj = self[related_model_name]
+ #print "XXX2", obj, f, related_name, related_model_name, refobj.plural_name
cobj = copy.deepcopy(refobj)
cobj.multi = True
@@ -154,22 +159,32 @@
-
+
def main():
- if len(sys.argv)==3:
- apps = [x.strip() for x in sys.argv[1].split(",")]
- output = sys.argv[2]
- elif len(sys.argv)==2:
- apps = ["core"]
- output = sys.argv[1]
- else:
- print 'Usage: modelgen <output_template>'
- print 'Alternative Usage: modelgen <app> <output_template>'
- exit(1)
+ global options
+ parser = OptionParser(usage="modelgen [options] <template_fn>", )
+
+ parser.add_option("-a", "--app", dest="apps",
+ help="list of applications to parse", metavar="APP", default=[], action="append")
+ parser.add_option("-b", "--blacklist", dest="blacklist",
+ help="add model name to blacklist", metavar="MODEL", default=["SingletonModel", "PlCoreBase"], action="append")
+ parser.add_option("-n", "--no-rest", dest="norest",
+ help="do not generate rest api for model", metavar="MODEL", default=["SingletonModel", "PlCoreBase"], action="append")
+
+ (options, args) = parser.parse_args(sys.argv[1:])
+
+ if not options.apps:
+ options.apps = ["core"]
+
+ if len(args)!=1:
+ print 'Usage: modelgen [options] <template_fn>'
+ exit(1)
+
+ output = args[0]
generator = Generator()
- models = enum_classes(apps)
+ models = enum_classes(options.apps)
for m in models:
generator.add_object(m)
diff --git a/xos/core/static/xos.css b/xos/core/static/xos.css
index 96ca8b1..33d05cb 100644
--- a/xos/core/static/xos.css
+++ b/xos/core/static/xos.css
@@ -1,4 +1,4 @@
-/*************************
+g/*************************
colors:
tab - active/focus color
background-color: #105E9E !important;
@@ -483,7 +483,8 @@
.login #content-main h1 {
/*background: #EBF0F2;*/
-background: url("open-cloud-login-themed-light.png") no-repeat scroll 40% center / 89% auto rgba(235, 240, 242, 0);
+/*background: url("open-cloud-login-themed-light.png") no-repeat scroll 40% center / 89% auto rgba(235, 240, 242, 0);*/
+background: url("cord_logo_3.png") no-repeat scroll 40% center / 89% auto rgba(235, 240, 242, 0);
/*background-position: 40%;*/
height: 55px;
background-repeat: no-repeat;
diff --git a/xos/core/xoslib/xos-builder/README.md b/xos/core/xoslib/xos-builder/README.md
new file mode 100644
index 0000000..7e15de6
--- /dev/null
+++ b/xos/core/xoslib/xos-builder/README.md
@@ -0,0 +1,46 @@
+# XOS Lib Helper
+
+This library should help you while developing with:
+
+#### Serve
+- Install Bower deps
+- Load js files (from args folder)
+- Load html templates (from args folder)
+- Compile ES6
+- Compile Scss
+- Compile template using `ng2html`
+- Watch source folder
+- Livereload
+- Generate a basic index.html in a `dist` folder under `args` folder loading files
+
+#### Build
+- Install Bower deps
+- Load js files (from args folder)
+- Load html templates (from args folder)
+- Compile ES6
+- Compile Scss
+- Compile template using `ng2html`
+- Minify Js & Css
+- Prefix Css
+- Cicle trough `bower.json` and diff it with base `bower.json` to exclude already loaded modules (eg: angular) [Optional]
+- Move `dist` under xos folder
+
+## App Structure
+
+App Name
+└- src
+ ├ js
+ ├ templates
+ ├ bower_components
+ └ dist
+
+Angular apps should be saved under `xoslib/source` and builded apps should be moved under `xoslib/static/js`.
+
+Two files should be generated, `appname_main.js` and `appname_vendor.js`, these file should be included into `xoslib/dashboards/appname.html` (tbd if this file has to be automatically generated during the build)
+
+## Advantages
+
+- Faster development with common tool
+- Standard build for community developer
+- Minified files
+
diff --git a/xos/core/xoslib/xos-builder/package.json b/xos/core/xoslib/xos-builder/package.json
new file mode 100644
index 0000000..bc6e6e3
--- /dev/null
+++ b/xos/core/xoslib/xos-builder/package.json
@@ -0,0 +1,23 @@
+{
+ "name": "xos-builder",
+ "version": "1.0.0",
+ "description": "Angular Application Builder tailored to XOS needings",
+ "main": "xos-builder.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [
+ "XOS",
+ "Angular",
+ "XOSlib"
+ ],
+ "author": "Matteo Scandolo",
+ "license": "ISC",
+ "bin": {
+ "xos": "xos-builder.js"
+ },
+ "dependencies": {
+ "chalk": "^1.1.1",
+ "chalkline": "0.0.4"
+ }
+}
diff --git a/xos/core/xoslib/xos-builder/xos-builder.js b/xos/core/xoslib/xos-builder/xos-builder.js
new file mode 100755
index 0000000..d6adfe5
--- /dev/null
+++ b/xos/core/xoslib/xos-builder/xos-builder.js
@@ -0,0 +1,20 @@
+#! /usr/bin/env node
+'use strict';
+
+const assert = require('assert');
+const chalk = require('chalk');
+
+const args = process.argv.slice(2);
+
+const error = chalk.white.bgRed;
+const success = chalk.white.bgGreen;
+
+const task = args[0];
+if(!task){
+ console.log(error('A task should be defined'))
+ process.exit(1);
+}
+
+console.log(success('Build Started for'));
+
+console.log(process.argv);
diff --git a/xos/templates/admin/base.html b/xos/templates/admin/base.html
index d29456a..a7cc0c4 100644
--- a/xos/templates/admin/base.html
+++ b/xos/templates/admin/base.html
@@ -6,6 +6,7 @@
<link rel="stylesheet" type="text/css" href="{% static 'suit/bootstrap/css/bootstrap.min.css' %}" media="all"/>
<link rel="stylesheet" type="text/css" href="{% static 'suit/css/suit.css' %}" media="all">
<link rel="stylesheet" type="text/css" href="{% static 'xos.css' %}" media="all">
+ <link rel="stylesheet" type="text/css" href="{% static 'cord.css' %}" media="all">
{% if XOS_BRANDING_CSS %}
<link rel="stylesheet" type="text/css" href="{{ XOS_BRANDING_CSS }}">
{% endif %}
@@ -43,7 +44,7 @@
<div id="container">
{% block logo %}
- <a href="{% url 'admin:index' %}"><h1 id="site-name"><img class="logo" height="70" width="259" src="{% static 'open-cloud-login-themed-light.png' %}"/></h1></a>
+ <a href="{% url 'admin:index' %}"><h1 id="site-name"><img class="logo" height="70" width="259" src="{% static 'cord_logo_3.png' %}"/></h1></a>
{% endblock %}
{% block header %}
{% if not is_popup %}
diff --git a/xos/templates/admin/dashboard/customize.html b/xos/templates/admin/dashboard/customize.html
index d2e8a20..eb92b21 100644
--- a/xos/templates/admin/dashboard/customize.html
+++ b/xos/templates/admin/dashboard/customize.html
@@ -1,39 +1,50 @@
-<form>
+<div class="row-fluid">
+ <div class="span12 text-right">
+ <a href="core/dashboardview/add/" class="btn btn-success">
+ <i class="icon icon-plus"></i> Add
+ </a>
+ </div>
+</div>
+<form>
<div class="customize_row">
- <div class="customize_column">
- <div>Available Dashboard Views</div>
- <select name="selectfrom" id="select-from" multiple size="5">
- {% for cp in unusedDashboards %}
- <option value="{{ cp }}">{{ cp }}</option>
- {% endfor %}
- </select>
- </div>
- <div class="customize_column">
- <br>
- <div class="btn btn-success" id="customize-btn-add">Add »</div><br><br>
- <div class="btn btn-success" id="customize-btn-remove">« Remove</div>
- </div>
- <div class="customize_column">
- <div>Selected Dashboard Views</div>
- <select name="selectto" id="select-to" multiple size="5">
- {% for cp in dashboards %}
- <option value="{{ cp }}">{{ cp }}</option>
- {% endfor %}
- </select>
- <br>
- <div class="btn btn-high btn-info" id="customize-btn-save">Save</div>
- <div style="display: none" id="customize-msg-saving">Saving...</div>
- </div>
- <div class="customize_column">
- <br>
- <div class="btn btn-success" id="customize-btn-up">Up</div><br><br>
- <div class="btn btn-success" id="customize-btn-down">Down</div>
- </div>
+ <div class="customize_column">
+ <div>Available Dashboard Views</div>
+ <select name="selectfrom" id="select-from" multiple size="5">
+ {% for cp in unusedDashboards %}
+ <option value="{{ cp }}">{{ cp }}</option>
+ {% endfor %}
+ </select>
+ </div>
+ <div class="customize_column">
+ <br>
+ <div class="btn btn-success" id="customize-btn-add">Add »</div>
+ <br>
+ <br>
+ <div class="btn btn-success" id="customize-btn-remove">« Remove</div>
+ </div>
+ <div class="customize_column">
+ <div>Selected Dashboard Views</div>
+ <select name="selectto" id="select-to" multiple size="5">
+ {% for cp in dashboards %}
+ <option value="{{ cp }}">{{ cp }}</option>
+ {% endfor %}
+ </select>
+ <br>
+ <div class="btn btn-high btn-info" id="customize-btn-save">Save</div>
+ <div style="display: none" id="customize-msg-saving">Saving...</div>
+ </div>
+ <div class="customize_column">
+ <br>
+ <div class="btn btn-success" id="customize-btn-up">Up</div>
+ <br>
+ <br>
+ <div class="btn btn-success" id="customize-btn-down">Down</div>
+ </div>
</div>
</form>
-
-<script>
-$(document).ready(function() {
+
+<script>
+$(document).ready(function() {
$('#customize-btn-add').click(function(){
$('#select-from option:selected').each( function() {
$('#select-to').append("<option value='"+$(this).val()+"'>"+$(this).text()+"</option>");
@@ -71,23 +82,22 @@
var items=[];
$("#select-to option").each(function() { items.push($(this).val()); });
$.ajax({
- url: '/customize/',
- dataType: 'json',
- data: {
- dashboards: items.join(","),
- csrfmiddlewaretoken: "{{ csrf_token }}" // < here
- },
- type: 'POST',
- error: function (jqXHR, textStatus, errorThrown) {
- errorDialog("Error", textStatus + " " + jqXHR.responseText);
- $("#customize-btn-save").show();
- $("#customize-msg-saving").hide();
- },
- success: function () {
- location.reload();
- }
+ url: '/customize/',
+ dataType: 'json',
+ data: {
+ dashboards: items.join(","),
+ csrfmiddlewaretoken: "{{ csrf_token }}" // < here
+ },
+ type: 'POST',
+ error: function (jqXHR, textStatus, errorThrown) {
+ errorDialog("Error", textStatus + " " + jqXHR.responseText);
+ $("#customize-btn-save").show();
+ $("#customize-msg-saving").hide();
+ },
+ success: function () {
+ location.reload();
+ }
});
- });
-});
-</script>
-
+ });
+});
+</script>
\ No newline at end of file
diff --git a/xos/xos/hpcapi.py b/xos/xos/hpcapi.py
index 389238e..f0e3a6c 100644
--- a/xos/xos/hpcapi.py
+++ b/xos/xos/hpcapi.py
@@ -38,9 +38,6 @@
return patterns('',
url(r'^hpcapi/$', hpc_api_root),
- url(r'hpcapi/services/$', ServiceList.as_view(), name='service-list'),
- url(r'hpcapi/services/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceDetail.as_view(), name ='service-detail'),
-
url(r'hpcapi/hpchealthchecks/$', HpcHealthCheckList.as_view(), name='hpchealthcheck-list'),
url(r'hpcapi/hpchealthchecks/(?P<pk>[a-zA-Z0-9\-]+)/$', HpcHealthCheckDetail.as_view(), name ='hpchealthcheck-detail'),
@@ -53,9 +50,6 @@
url(r'hpcapi/cdnprefixs/$', CDNPrefixList.as_view(), name='cdnprefix-list'),
url(r'hpcapi/cdnprefixs/(?P<pk>[a-zA-Z0-9\-]+)/$', CDNPrefixDetail.as_view(), name ='cdnprefix-detail'),
- url(r'hpcapi/users/$', UserList.as_view(), name='user-list'),
- url(r'hpcapi/users/(?P<pk>[a-zA-Z0-9\-]+)/$', UserDetail.as_view(), name ='user-detail'),
-
url(r'hpcapi/serviceproviders/$', ServiceProviderList.as_view(), name='serviceprovider-list'),
url(r'hpcapi/serviceproviders/(?P<pk>[a-zA-Z0-9\-]+)/$', ServiceProviderDetail.as_view(), name ='serviceprovider-detail'),
@@ -73,12 +67,10 @@
@api_view(['GET'])
def hpc_api_root(request, format=None):
return Response({
- 'services': reverse('service-list', request=request, format=format),
'hpchealthchecks': reverse('hpchealthcheck-list', request=request, format=format),
'hpcservices': reverse('hpcservice-list', request=request, format=format),
'originservers': reverse('originserver-list', request=request, format=format),
'cdnprefixs': reverse('cdnprefix-list', request=request, format=format),
- 'users': reverse('user-list', request=request, format=format),
'serviceproviders': reverse('serviceprovider-list', request=request, format=format),
'contentproviders': reverse('contentprovider-list', request=request, format=format),
'accessmaps': reverse('accessmap-list', request=request, format=format),
@@ -142,41 +134,6 @@
-class ServiceSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
- humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
- validators = serializers.SerializerMethodField("getValidators")
- def getHumanReadableName(self, obj):
- return str(obj)
- def getValidators(self, obj):
- try:
- return obj.getValidators()
- except:
- return None
- class Meta:
- model = Service
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','description','enabled','kind','name','versionNumber','published','view_url','icon_url','public_key','service_specific_id','service_specific_attribute',)
-
-class ServiceIdSerializer(XOSModelSerializer):
- id = IdField()
-
- humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
- validators = serializers.SerializerMethodField("getValidators")
- def getHumanReadableName(self, obj):
- return str(obj)
- def getValidators(self, obj):
- try:
- return obj.getValidators()
- except:
- return None
- class Meta:
- model = Service
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','description','enabled','kind','name','versionNumber','published','view_url','icon_url','public_key','service_specific_id','service_specific_attribute',)
-
-
-
-
class HpcHealthCheckSerializer(serializers.HyperlinkedModelSerializer):
id = IdField()
@@ -317,49 +274,6 @@
-class UserSerializer(serializers.HyperlinkedModelSerializer):
- id = IdField()
-
-
- contentproviders = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='contentprovider-detail')
-
-
- humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
- validators = serializers.SerializerMethodField("getValidators")
- def getHumanReadableName(self, obj):
- return str(obj)
- def getValidators(self, obj):
- try:
- return obj.getValidators()
- except:
- return None
- class Meta:
- model = User
- fields = ('humanReadableName', 'validators', 'id','password','last_login','email','username','firstname','lastname','phone','user_url','site','public_key','is_active','is_admin','is_staff','is_readonly','is_registering','is_appuser','login_page','created','updated','enacted','policed','backend_status','deleted','write_protect','timezone','contentproviders',)
-
-class UserIdSerializer(XOSModelSerializer):
- id = IdField()
-
-
- contentproviders = serializers.PrimaryKeyRelatedField(many=True, queryset = ContentProvider.objects.all())
-
-
- humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
- validators = serializers.SerializerMethodField("getValidators")
- def getHumanReadableName(self, obj):
- return str(obj)
- def getValidators(self, obj):
- try:
- return obj.getValidators()
- except:
- return None
- class Meta:
- model = User
- fields = ('humanReadableName', 'validators', 'id','password','last_login','email','username','firstname','lastname','phone','user_url','site','public_key','is_active','is_admin','is_staff','is_readonly','is_registering','is_appuser','login_page','created','updated','enacted','policed','backend_status','deleted','write_protect','timezone','contentproviders',)
-
-
-
-
class ServiceProviderSerializer(serializers.HyperlinkedModelSerializer):
id = IdField()
@@ -398,21 +312,9 @@
class ContentProviderSerializer(serializers.HyperlinkedModelSerializer):
id = IdField()
- humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
- validators = serializers.SerializerMethodField("getValidators")
- def getHumanReadableName(self, obj):
- return str(obj)
- def getValidators(self, obj):
- try:
- return obj.getValidators()
- except:
- return None
- class Meta:
- model = ContentProvider
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','content_provider_id','name','enabled','description','serviceProvider',)
-
-class ContentProviderIdSerializer(XOSModelSerializer):
- id = IdField()
+
+ users = serializers.HyperlinkedRelatedField(many=True, read_only=True, view_name='user-detail')
+
humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
validators = serializers.SerializerMethodField("getValidators")
@@ -425,7 +327,27 @@
return None
class Meta:
model = ContentProvider
- fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','content_provider_id','name','enabled','description','serviceProvider',)
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','content_provider_id','name','enabled','description','serviceProvider','users',)
+
+class ContentProviderIdSerializer(XOSModelSerializer):
+ id = IdField()
+
+
+ users = serializers.PrimaryKeyRelatedField(many=True, queryset = User.objects.all())
+
+
+ humanReadableName = serializers.SerializerMethodField("getHumanReadableName")
+ validators = serializers.SerializerMethodField("getValidators")
+ def getHumanReadableName(self, obj):
+ return str(obj)
+ def getValidators(self, obj):
+ try:
+ return obj.getValidators()
+ except:
+ return None
+ class Meta:
+ model = ContentProvider
+ fields = ('humanReadableName', 'validators', 'id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','content_provider_id','name','enabled','description','serviceProvider','users',)
@@ -502,8 +424,6 @@
serializerLookUp = {
- Service: ServiceSerializer,
-
HpcHealthCheck: HpcHealthCheckSerializer,
HpcService: HpcServiceSerializer,
@@ -512,8 +432,6 @@
CDNPrefix: CDNPrefixSerializer,
- User: UserSerializer,
-
ServiceProvider: ServiceProviderSerializer,
ContentProvider: ContentProviderSerializer,
@@ -528,53 +446,6 @@
# Based on core/views/*.py
-class ServiceList(XOSListCreateAPIView):
- queryset = Service.objects.select_related().all()
- serializer_class = ServiceSerializer
- id_serializer_class = ServiceIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','description','enabled','kind','name','versionNumber','published','view_url','icon_url','public_key','service_specific_id','service_specific_attribute',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"QUERY_PARAMS"):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def get_queryset(self):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Service.select_by_user(self.request.user)
-
-
-class ServiceDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = Service.objects.select_related().all()
- serializer_class = ServiceSerializer
- id_serializer_class = ServiceIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"QUERY_PARAMS"):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def get_queryset(self):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return Service.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
class HpcHealthCheckList(XOSListCreateAPIView):
queryset = HpcHealthCheck.objects.select_related().all()
serializer_class = HpcHealthCheckSerializer
@@ -763,53 +634,6 @@
-class UserList(XOSListCreateAPIView):
- queryset = User.objects.select_related().all()
- serializer_class = UserSerializer
- id_serializer_class = UserIdSerializer
- filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','password','last_login','email','username','firstname','lastname','phone','user_url','site','public_key','is_active','is_admin','is_staff','is_readonly','is_registering','is_appuser','login_page','created','updated','enacted','policed','backend_status','deleted','write_protect','timezone','contentproviders',)
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"QUERY_PARAMS"):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def get_queryset(self):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return User.select_by_user(self.request.user)
-
-
-class UserDetail(XOSRetrieveUpdateDestroyAPIView):
- queryset = User.objects.select_related().all()
- serializer_class = UserSerializer
- id_serializer_class = UserIdSerializer
-
- def get_serializer_class(self):
- no_hyperlinks=False
- if hasattr(self.request,"QUERY_PARAMS"):
- no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
- if (no_hyperlinks):
- return self.id_serializer_class
- else:
- return self.serializer_class
-
- def get_queryset(self):
- if (not self.request.user.is_authenticated()):
- raise XOSNotAuthenticated()
- return User.select_by_user(self.request.user)
-
- # update() is handled by XOSRetrieveUpdateDestroyAPIView
-
- # destroy() is handled by XOSRetrieveUpdateDestroyAPIView
-
-
-
class ServiceProviderList(XOSListCreateAPIView):
queryset = ServiceProvider.objects.select_related().all()
serializer_class = ServiceProviderSerializer
@@ -862,7 +686,7 @@
serializer_class = ContentProviderSerializer
id_serializer_class = ContentProviderIdSerializer
filter_backends = (filters.DjangoFilterBackend,)
- filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','content_provider_id','name','enabled','description','serviceProvider',)
+ filter_fields = ('id','created','updated','enacted','policed','backend_register','backend_status','deleted','write_protect','lazy_blocked','no_sync','content_provider_id','name','enabled','description','serviceProvider','users',)
def get_serializer_class(self):
no_hyperlinks=False