1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Added description to ConfigContext

This commit is contained in:
Jeremy Stretch
2018-06-29 09:44:32 -04:00
parent ace7e3b108
commit 743cf6d398
7 changed files with 22 additions and 4 deletions

View File

@ -140,7 +140,9 @@ class ConfigContextSerializer(ValidatedModelSerializer):
class Meta: class Meta:
model = ConfigContext model = ConfigContext
fields = ['name', 'weight', 'is_active', 'regions', 'sites', 'roles', 'platforms', 'tenants', 'data'] fields = [
'name', 'weight', 'description', 'is_active', 'regions', 'sites', 'roles', 'platforms', 'tenants', 'data',
]
# #

View File

@ -197,7 +197,9 @@ class ConfigContextForm(BootstrapMixin, forms.ModelForm):
class Meta: class Meta:
model = ConfigContext model = ConfigContext
fields = ['name', 'weight', 'is_active', 'regions', 'sites', 'roles', 'platforms', 'tenants', 'data'] fields = [
'name', 'weight', 'description', 'is_active', 'regions', 'sites', 'roles', 'platforms', 'tenants', 'data',
]
# #

View File

@ -1,4 +1,4 @@
# Generated by Django 2.0.6 on 2018-06-27 17:45 # Generated by Django 2.0.6 on 2018-06-29 13:34
import django.contrib.postgres.fields.jsonb import django.contrib.postgres.fields.jsonb
from django.db import migrations, models from django.db import migrations, models
@ -20,6 +20,7 @@ class Migration(migrations.Migration):
('name', models.CharField(max_length=100, unique=True)), ('name', models.CharField(max_length=100, unique=True)),
('weight', models.PositiveSmallIntegerField(default=1000)), ('weight', models.PositiveSmallIntegerField(default=1000)),
('is_active', models.BooleanField(default=True)), ('is_active', models.BooleanField(default=True)),
('description', models.CharField(blank=True, max_length=100)),
('data', django.contrib.postgres.fields.jsonb.JSONField()), ('data', django.contrib.postgres.fields.jsonb.JSONField()),
('platforms', models.ManyToManyField(blank=True, related_name='_configcontext_platforms_+', to='dcim.Platform')), ('platforms', models.ManyToManyField(blank=True, related_name='_configcontext_platforms_+', to='dcim.Platform')),
('regions', models.ManyToManyField(blank=True, related_name='_configcontext_regions_+', to='dcim.Region')), ('regions', models.ManyToManyField(blank=True, related_name='_configcontext_regions_+', to='dcim.Region')),

View File

@ -646,6 +646,10 @@ class ConfigContext(models.Model):
weight = models.PositiveSmallIntegerField( weight = models.PositiveSmallIntegerField(
default=1000 default=1000
) )
description = models.CharField(
max_length=100,
blank=True
)
is_active = models.BooleanField( is_active = models.BooleanField(
default=True, default=True,
) )

View File

@ -70,7 +70,7 @@ class ConfigContextTable(BaseTable):
class Meta(BaseTable.Meta): class Meta(BaseTable.Meta):
model = ConfigContext model = ConfigContext
fields = ('pk', 'name', 'weight', 'is_active') fields = ('pk', 'name', 'weight', 'is_active', 'description', 'actions')
class ObjectChangeTable(BaseTable): class ObjectChangeTable(BaseTable):

View File

@ -7,7 +7,13 @@
<div class="panel-body"> <div class="panel-body">
{% render_field form.name %} {% render_field form.name %}
{% render_field form.weight %} {% render_field form.weight %}
{% render_field form.description %}
{% render_field form.is_active %} {% render_field form.is_active %}
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>Assignment</strong></div>
<div class="panel-body">
{% render_field form.regions %} {% render_field form.regions %}
{% render_field form.sites %} {% render_field form.sites %}
{% render_field form.roles %} {% render_field form.roles %}

View File

@ -26,6 +26,9 @@
<span class="text-muted">{{ context.weight }}</span> <span class="text-muted">{{ context.weight }}</span>
</div> </div>
<a href="{{ context.get_absolute_url }}"><strong>{{ context.name }}</strong></a> <a href="{{ context.get_absolute_url }}"><strong>{{ context.name }}</strong></a>
{% if context.description %}
<br /><small>{{ context.description }}</small>
{% endif %}
<pre>{{ context.data|render_json }}</pre> <pre>{{ context.data|render_json }}</pre>
</div> </div>
{% endfor %} {% endfor %}