rename reverse relation of nodelabel to fix issue with apigen
diff --git a/xos/core/admin.py b/xos/core/admin.py
index 0608e4e..3ace086 100644
--- a/xos/core/admin.py
+++ b/xos/core/admin.py
@@ -1266,7 +1266,7 @@
list_display_links = ('backend_status_icon', 'name', )
class NodeForm(forms.ModelForm):
- labels = forms.ModelMultipleChoiceField(
+ nodelabels = forms.ModelMultipleChoiceField(
queryset=NodeLabel.objects.all(),
required=False,
help_text="Select which labels apply to this node",
@@ -1286,12 +1286,12 @@
super(NodeForm, self).__init__(*args, **kwargs)
if self.instance and self.instance.pk:
- self.fields['labels'].initial = self.instance.labels.all()
+ self.fields['nodelabels'].initial = self.instance.nodelabels.all()
def save(self, commit=True):
node = super(NodeForm, self).save(commit=False)
- node.labels = self.cleaned_data['labels']
+ node.nodelabels = self.cleaned_data['nodelabels']
if commit:
node.save()
@@ -1314,7 +1314,7 @@
inlines = [TagInline,InstanceInline]
fieldsets = [('Node Details', {'fields': ['backend_status_text', 'name', 'site_deployment'], 'classes':['suit-tab suit-tab-details']}),
- ('Labels', {'fields': ['labels'], 'classes':['suit-tab suit-tab-labels']})]
+ ('Labels', {'fields': ['nodelabels'], 'classes':['suit-tab suit-tab-labels']})]
readonly_fields = ('backend_status_text', )
user_readonly_fields = ['name','site_deployment']
diff --git a/xos/core/models/node.py b/xos/core/models/node.py
index b825787..d464532 100644
--- a/xos/core/models/node.py
+++ b/xos/core/models/node.py
@@ -31,6 +31,6 @@
class NodeLabel(PlCoreBase):
name = StrippedCharField(max_length=200, help_text="label name", unique=True)
- node = models.ManyToManyField(Node, related_name="labels", blank=True)
+ node = models.ManyToManyField(Node, related_name="nodelabels", blank=True)
def __unicode__(self): return u'%s' % (self.name)
diff --git a/xos/core/models/service.py b/xos/core/models/service.py
index 124feb5..aca4bb0 100644
--- a/xos/core/models/service.py
+++ b/xos/core/models/service.py
@@ -458,7 +458,7 @@
nodes = Node.objects.all()
if self.label:
- nodes = nodes.filter(labels__name=self.label)
+ nodes = nodes.filter(nodelabels__name=self.label)
nodes = list(nodes)
@@ -778,6 +778,8 @@
value = models.TextField(help_text="Attribute Value")
tenant = models.ForeignKey(Tenant, related_name='tenantattributes', help_text="The Tenant this attribute is associated with")
+ def __unicode__(self): return u'%s-%s' % (self.name, self.id)
+
class TenantRootRole(PlCoreBase):
ROLE_CHOICES = (('admin','Admin'), ('access','Access'))