-
Couldn't load subscription status.
- Fork 2
fix(bulk-import): lookup custom object via slug #252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Generated by Django 5.2.7 on 2025-10-20 13:24 | ||
|
|
||
| import django.db.models.functions.text | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('core', '0019_configrevision_active'), | ||
| ('extras', '0133_make_cf_minmax_decimal'), | ||
| ('netbox_custom_objects', '0001_initial'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddConstraint( | ||
| model_name='customobjecttype', | ||
| constraint=models.UniqueConstraint(django.db.models.functions.text.Lower('slug'), name='netbox_custom_objects_customobjecttype_slug', violation_error_message='A Custom Object Type with this slug already exists.'), | ||
| ), | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -209,6 +209,13 @@ class Meta: | |
| "A Custom Object Type with this name already exists." | ||
| ), | ||
| ), | ||
| models.UniqueConstraint( | ||
|
||
| Lower("slug"), | ||
| name="%(app_label)s_%(class)s_slug", | ||
| violation_error_message=_( | ||
| "A Custom Object Type with this slug already exists." | ||
| ), | ||
| ), | ||
| ] | ||
|
|
||
| def __str__(self): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this UniqueConstraint is necessary (I don't think it is), could you please rename this migration to something a bit more informative/less unwieldy (following the usual pattern in NetBox core migrations)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the unique constraint