mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Added description to Tenant model
This commit is contained in:
@ -52,6 +52,16 @@
|
|||||||
<a href="{{ tenant.group.get_absolute_url }}">{{ tenant.group }}</a>
|
<a href="{{ tenant.group.get_absolute_url }}">{{ tenant.group }}</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Description</td>
|
||||||
|
<td>
|
||||||
|
{% if tenant.description %}
|
||||||
|
{{ tenant.description }}
|
||||||
|
{% else %}
|
||||||
|
<span class="text-muted">N/A</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Created</td>
|
<td>Created</td>
|
||||||
<td>{{ tenant.created }}</td>
|
<td>{{ tenant.created }}</td>
|
||||||
|
@ -30,7 +30,7 @@ class TenantForm(forms.ModelForm, BootstrapMixin):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Tenant
|
model = Tenant
|
||||||
fields = ['name', 'slug', 'group', 'comments']
|
fields = ['name', 'slug', 'group', 'description', 'comments']
|
||||||
|
|
||||||
|
|
||||||
class TenantFromCSVForm(forms.ModelForm):
|
class TenantFromCSVForm(forms.ModelForm):
|
||||||
@ -39,7 +39,7 @@ class TenantFromCSVForm(forms.ModelForm):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Tenant
|
model = Tenant
|
||||||
fields = ['name', 'slug', 'group', 'comments']
|
fields = ['name', 'slug', 'group', 'description', 'comments']
|
||||||
|
|
||||||
|
|
||||||
class TenantImportForm(BulkImportForm, BootstrapMixin):
|
class TenantImportForm(BulkImportForm, BootstrapMixin):
|
||||||
|
25
netbox/tenancy/migrations/0002_add_tenant_description.py
Normal file
25
netbox/tenancy/migrations/0002_add_tenant_description.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.9.8 on 2016-07-26 21:44
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('tenancy', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='tenant',
|
||||||
|
name='description',
|
||||||
|
field=models.CharField(blank=True, help_text=b'Long-form name (optional)', max_length=100),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='tenant',
|
||||||
|
name='name',
|
||||||
|
field=models.CharField(max_length=30, unique=True),
|
||||||
|
),
|
||||||
|
]
|
@ -26,9 +26,10 @@ class Tenant(CreatedUpdatedModel):
|
|||||||
A Tenant represents an organization served by the NetBox owner. This is typically a customer or an internal
|
A Tenant represents an organization served by the NetBox owner. This is typically a customer or an internal
|
||||||
department.
|
department.
|
||||||
"""
|
"""
|
||||||
name = models.CharField(max_length=50, unique=True)
|
name = models.CharField(max_length=30, unique=True)
|
||||||
slug = models.SlugField(unique=True)
|
slug = models.SlugField(unique=True)
|
||||||
group = models.ForeignKey('TenantGroup', related_name='tenants', on_delete=models.PROTECT)
|
group = models.ForeignKey('TenantGroup', related_name='tenants', on_delete=models.PROTECT)
|
||||||
|
description = models.CharField(max_length=100, blank=True, help_text="Long-form name (optional)")
|
||||||
comments = models.TextField(blank=True)
|
comments = models.TextField(blank=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -37,7 +37,8 @@ class TenantTable(BaseTable):
|
|||||||
pk = ToggleColumn()
|
pk = ToggleColumn()
|
||||||
name = tables.LinkColumn('tenancy:tenant', args=[Accessor('slug')], verbose_name='Name')
|
name = tables.LinkColumn('tenancy:tenant', args=[Accessor('slug')], verbose_name='Name')
|
||||||
group = tables.Column(verbose_name='Group')
|
group = tables.Column(verbose_name='Group')
|
||||||
|
description = tables.Column(verbose_name='Description')
|
||||||
|
|
||||||
class Meta(BaseTable.Meta):
|
class Meta(BaseTable.Meta):
|
||||||
model = Tenant
|
model = Tenant
|
||||||
fields = ('pk', 'name', 'group')
|
fields = ('pk', 'name', 'group', 'description')
|
||||||
|
Reference in New Issue
Block a user