set default value for creator field
diff --git a/xos/ceilometer/admin.py b/xos/ceilometer/admin.py
index 72d00d6..48bf101 100644
--- a/xos/ceilometer/admin.py
+++ b/xos/ceilometer/admin.py
@@ -11,6 +11,7 @@
from django.contrib.contenttypes import generic
from suit.widgets import LinkedSelect
from core.admin import ServiceAppAdmin,SliceInline,ServiceAttrAsTabInline, ReadOnlyAwareAdmin, XOSTabularInline, ServicePrivilegeInline, TenantRootTenantInline, TenantRootPrivilegeInline
+from core.middleware import get_request
from functools import update_wrapper
from django.contrib.admin.views.main import ChangeList
@@ -57,6 +58,7 @@
if (not self.instance) or (not self.instance.pk):
# default fields for an 'add' form
self.fields['kind'].initial = CEILOMETER_KIND
+ self.fields['creator'].initial = get_request().user
if CeilometerService.get_service_objects().exists():
self.fields["provider_service"].initial = CeilometerService.get_service_objects().all()[0]
diff --git a/xos/cord/admin.py b/xos/cord/admin.py
index 78af409..103f1d0 100644
--- a/xos/cord/admin.py
+++ b/xos/cord/admin.py
@@ -11,6 +11,7 @@
from django.contrib.contenttypes import generic
from suit.widgets import LinkedSelect
from core.admin import ServiceAppAdmin,SliceInline,ServiceAttrAsTabInline, ReadOnlyAwareAdmin, XOSTabularInline, ServicePrivilegeInline, TenantRootTenantInline, TenantRootPrivilegeInline
+from core.middleware import get_request
from functools import update_wrapper
from django.contrib.admin.views.main import ChangeList
@@ -64,6 +65,7 @@
if (not self.instance) or (not self.instance.pk):
# default fields for an 'add' form
self.fields['kind'].initial = VOLT_KIND
+ self.fields['creator'].initial = get_request().user
if VOLTService.get_service_objects().exists():
self.fields["provider_service"].initial = VOLTService.get_service_objects().all()[0]
@@ -172,6 +174,7 @@
if (not self.instance) or (not self.instance.pk):
# default fields for an 'add' form
self.fields['kind'].initial = VCPE_KIND
+ self.fields['creator'].initial = get_request().user
if VCPEService.get_service_objects().exists():
self.fields["provider_service"].initial = VCPEService.get_service_objects().all()[0]