Skip to content

Commit

Permalink
[enhancement] Removed org field snapshot openwisp#128
Browse files Browse the repository at this point in the history
Fixes openwisp#128 removed organisation field from snapshot model.
  • Loading branch information
Aryamanz29 committed Feb 2, 2022
1 parent c121984 commit 3a881ab
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
3 changes: 1 addition & 2 deletions openwisp_network_topology/base/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
from django.db import models
from django.utils.translation import gettext_lazy as _

from openwisp_users.mixins import OrgMixin
from openwisp_utils.base import TimeStampedEditableModel


class AbstractSnapshot(OrgMixin, TimeStampedEditableModel):
class AbstractSnapshot(TimeStampedEditableModel):
"""
NetJSON NetworkGraph Snapshot implementation
"""
Expand Down
2 changes: 1 addition & 1 deletion openwisp_network_topology/base/topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def save_snapshot(self, **kwargs):
"""
Snapshot = self.snapshot_model
date = datetime.now().date()
options = dict(organization=self.organization, topology=self, date=date)
options = dict(topology=self, date=date)
options.update(kwargs)
try:
s = Snapshot.objects.get(**options)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.1.14 on 2022-02-02 07:12

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('topology', '0013_add_user_defined_properties_field'),
]

operations = [
migrations.RemoveField(
model_name='snapshot',
name='organization',
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,6 @@ class Migration(migrations.Migration):
('data', models.TextField()),
('date', models.DateField(auto_now=True)),
('details', models.CharField(blank=True, max_length=64, null=True)),
(
'organization',
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to=get_model_name('openwisp_users', 'Organization'),
verbose_name='organization',
),
),
(
'topology',
models.ForeignKey(
Expand Down

0 comments on commit 3a881ab

Please sign in to comment.