0199_macaddress.py 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import django.db.models.deletion
  2. import taggit.managers
  3. from django.db import migrations, models
  4. import dcim.fields
  5. import utilities.json
  6. class Migration(migrations.Migration):
  7. dependencies = [
  8. ('dcim', '0198_natural_ordering'),
  9. ('extras', '0122_charfield_null_choices'),
  10. ]
  11. operations = [
  12. migrations.CreateModel(
  13. name='MACAddress',
  14. fields=[
  15. ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
  16. ('created', models.DateTimeField(auto_now_add=True, null=True)),
  17. ('last_updated', models.DateTimeField(auto_now=True, null=True)),
  18. (
  19. 'custom_field_data',
  20. models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder),
  21. ),
  22. ('description', models.CharField(blank=True, max_length=200)),
  23. ('comments', models.TextField(blank=True)),
  24. ('mac_address', dcim.fields.MACAddressField()),
  25. ('assigned_object_id', models.PositiveBigIntegerField(blank=True, null=True)),
  26. (
  27. 'assigned_object_type',
  28. models.ForeignKey(
  29. blank=True,
  30. null=True,
  31. on_delete=django.db.models.deletion.PROTECT,
  32. related_name='+',
  33. to='contenttypes.contenttype',
  34. ),
  35. ),
  36. ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')),
  37. ],
  38. options={'abstract': False, 'ordering': ('mac_address',)},
  39. ),
  40. ]