mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-18 02:06:22 +00:00
* Add SavedTableConfig * Update table configuration logic to support TableConfigs * Update table config link when updating table * Correct docstring * Misc cleanup * Use multi-select widgets for column selection * Return null config params for tables with no model * Fix auto-selection of selected columns * Update migration * Clean up template * Enforce enabled/shared flags * Search/filter by table name * Misc cleanup * Fix population of selected columns * Ordering field should not be required * Enable cloning for TableConfig * Misc cleanup * Add model documentation for TableConfig * Drop slug field from TableConfig * Improve TableConfig validation * Remove add button from TableConfig list view * Fix ordering validation to account for leading hyphens
57 lines
2.3 KiB
Python
57 lines
2.3 KiB
Python
import django.contrib.postgres.fields
|
|
import django.db.models.deletion
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
('core', '0014_remove_redundant_indexes'),
|
|
('extras', '0126_configtemplate_as_attachment_and_more'),
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='TableConfig',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
|
|
('created', models.DateTimeField(auto_now_add=True, null=True)),
|
|
('last_updated', models.DateTimeField(auto_now=True, null=True)),
|
|
('table', models.CharField(max_length=100)),
|
|
('name', models.CharField(max_length=100)),
|
|
('description', models.CharField(blank=True, max_length=200)),
|
|
('weight', models.PositiveSmallIntegerField(default=100)),
|
|
('enabled', models.BooleanField(default=True)),
|
|
('shared', models.BooleanField(default=True)),
|
|
(
|
|
'columns',
|
|
django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), size=None),
|
|
),
|
|
(
|
|
'ordering',
|
|
django.contrib.postgres.fields.ArrayField(
|
|
base_field=models.CharField(max_length=100), blank=True, null=True, size=None
|
|
),
|
|
),
|
|
(
|
|
'object_type',
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE, related_name='table_configs', to='core.objecttype'
|
|
),
|
|
),
|
|
(
|
|
'user',
|
|
models.ForeignKey(
|
|
blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
'verbose_name': 'table config',
|
|
'verbose_name_plural': 'table configs',
|
|
'ordering': ('weight', 'name'),
|
|
},
|
|
),
|
|
]
|