Skip to content

Commit fa6cad1

Browse files
committed
DataFile should not inherit from ChangeLoggingMixin
1 parent 40ad9bf commit fa6cad1

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

netbox/core/migrations/0001_initial.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ class Migration(migrations.Migration):
4343
name='DataFile',
4444
fields=[
4545
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
46-
('created', models.DateTimeField(auto_now_add=True, null=True)),
47-
('path', models.CharField(editable=False, max_length=1000)),
46+
('created', models.DateTimeField(auto_now_add=True)),
4847
('last_updated', models.DateTimeField(editable=False)),
48+
('path', models.CharField(editable=False, max_length=1000)),
4949
('size', models.PositiveIntegerField(editable=False)),
5050
('hash', models.CharField(editable=False, max_length=64, validators=[django.core.validators.RegexValidator(message='Length must be 64 hexadecimal characters.', regex='^[0-9a-f]{64}$')])),
5151
('data', models.BinaryField()),

netbox/core/models/data.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,17 @@ def _ignore(self, filename):
228228
return False
229229

230230

231-
class DataFile(ChangeLoggingMixin, models.Model):
231+
class DataFile(models.Model):
232232
"""
233233
The database representation of a remote file fetched from a remote DataSource. DataFile instances should be created,
234234
updated, or deleted only by calling DataSource.sync().
235235
"""
236+
created = models.DateTimeField(
237+
auto_now_add=True
238+
)
239+
last_updated = models.DateTimeField(
240+
editable=False
241+
)
236242
source = models.ForeignKey(
237243
to='core.DataSource',
238244
on_delete=models.CASCADE,
@@ -244,9 +250,6 @@ class DataFile(ChangeLoggingMixin, models.Model):
244250
editable=False,
245251
help_text=_("File path relative to the data source's root")
246252
)
247-
last_updated = models.DateTimeField(
248-
editable=False
249-
)
250253
size = models.PositiveIntegerField(
251254
editable=False
252255
)

netbox/core/tests/test_views.py

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def setUpTestData(cls):
5050

5151
class DataFileTestCase(
5252
ViewTestCases.GetObjectViewTestCase,
53-
ViewTestCases.GetObjectChangelogViewTestCase,
5453
ViewTestCases.DeleteObjectViewTestCase,
5554
ViewTestCases.ListObjectsViewTestCase,
5655
ViewTestCases.BulkDeleteObjectsViewTestCase,

0 commit comments

Comments
 (0)