mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-05 08:57:19 +02:00
Closes #17166: Remove obsolete limit_choices_to argument from ForeignKey & M2M fields
This commit is contained in:
@@ -4,7 +4,6 @@ import taggit.managers
|
||||
from django.db import migrations, models
|
||||
|
||||
import utilities.json
|
||||
import wireless.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
@@ -149,7 +148,6 @@ class Migration(migrations.Migration):
|
||||
(
|
||||
'interface_a',
|
||||
models.ForeignKey(
|
||||
limit_choices_to=wireless.models.get_wireless_interface_types,
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
related_name='+',
|
||||
to='dcim.interface',
|
||||
@@ -158,7 +156,6 @@ class Migration(migrations.Migration):
|
||||
(
|
||||
'interface_b',
|
||||
models.ForeignKey(
|
||||
limit_choices_to=wireless.models.get_wireless_interface_types,
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
related_name='+',
|
||||
to='dcim.interface',
|
||||
|
||||
@@ -66,7 +66,6 @@ class Migration(migrations.Migration):
|
||||
name='scope_type',
|
||||
field=models.ForeignKey(
|
||||
blank=True,
|
||||
limit_choices_to=models.Q(('model__in', ('region', 'sitegroup', 'site', 'location'))),
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
related_name='+',
|
||||
|
||||
@@ -123,26 +123,18 @@ class WirelessLAN(WirelessAuthenticationBase, CachedScopeMixin, PrimaryModel):
|
||||
return WirelessLANStatusChoices.colors.get(self.status)
|
||||
|
||||
|
||||
def get_wireless_interface_types():
|
||||
# Wrap choices in a callable to avoid generating dummy migrations
|
||||
# when the choices are updated.
|
||||
return {'type__in': WIRELESS_IFACE_TYPES}
|
||||
|
||||
|
||||
class WirelessLink(WirelessAuthenticationBase, DistanceMixin, PrimaryModel):
|
||||
"""
|
||||
A point-to-point connection between two wireless Interfaces.
|
||||
"""
|
||||
interface_a = models.ForeignKey(
|
||||
to='dcim.Interface',
|
||||
limit_choices_to=get_wireless_interface_types,
|
||||
on_delete=models.PROTECT,
|
||||
related_name='+',
|
||||
verbose_name=_('interface A'),
|
||||
)
|
||||
interface_b = models.ForeignKey(
|
||||
to='dcim.Interface',
|
||||
limit_choices_to=get_wireless_interface_types,
|
||||
on_delete=models.PROTECT,
|
||||
related_name='+',
|
||||
verbose_name=_('interface B'),
|
||||
|
||||
Reference in New Issue
Block a user