From 30bda2b62185554e2f0c6b20d9c913eef492a308 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Thu, 9 Aug 2018 10:52:15 +0300 Subject: [PATCH] Remove unnecessary save after manytomany add --- abonapp/migrations/0002_auto_20180808_1448.py | 1 - abonapp/tests.py | 4 ---- accounts_app/views.py | 1 - ip_pool/tests.py | 1 - ip_pool/views.py | 1 - tariff_app/tests.py | 1 - 6 files changed, 9 deletions(-) diff --git a/abonapp/migrations/0002_auto_20180808_1448.py b/abonapp/migrations/0002_auto_20180808_1448.py index 571374d..84db8a7 100644 --- a/abonapp/migrations/0002_auto_20180808_1448.py +++ b/abonapp/migrations/0002_auto_20180808_1448.py @@ -62,7 +62,6 @@ def restore_info_to_new_scheme(apps, _): abon_db = Abon.objects.filter(pk=abon['pk']).first() if abon_db is not None: abon_db.ip_addresses.add(ip_lease.pk) - abon_db.save() print('\tUser %s: %s updated' % (abon_db.username, abon_db.fio)) else: print('\tUser with pk=%s not found' % abon['pk']) diff --git a/abonapp/tests.py b/abonapp/tests.py index cd24984..131b00c 100644 --- a/abonapp/tests.py +++ b/abonapp/tests.py @@ -364,7 +364,6 @@ class AbonServiceTestCase(MyBaseTestCase, TestCase): calc_type='Dp' ) tariff1.groups.add(self.group) - tariff1.save() tariff2 = Tariff.objects.create( title='trf2', descr='descr2', @@ -374,7 +373,6 @@ class AbonServiceTestCase(MyBaseTestCase, TestCase): calc_type='Dp' ) tariff2.groups.add(self.group) - tariff2.save() self.tariff1 = tariff1 self.tariff2 = tariff2 @@ -441,7 +439,6 @@ class ClientLeasesTestCase(MyBaseTestCase, TestCase): ip_end='192.168.0.6' ) netw.groups.add(self.group.pk) - netw.save() self.network = netw netw6 = NetworkModel.objects.create( network='fde8:86a9:f132:1::/64', @@ -451,7 +448,6 @@ class ClientLeasesTestCase(MyBaseTestCase, TestCase): ip_end='fde8:86a9:f132:1::2f' ) netw6.groups.add(self.group.pk) - netw6.save() self.network6 = netw6 def test_add_static_ipv4_lease(self): diff --git a/accounts_app/views.py b/accounts_app/views.py index 7571376..bb3bd56 100644 --- a/accounts_app/views.py +++ b/accounts_app/views.py @@ -315,6 +315,5 @@ class ManageResponsibilityGroups(ListView): profile = self.object profile.responsibility_groups.clear() profile.responsibility_groups.add(*checked_groups) - profile.save() messages.success(request, _('Responsibilities has been updated')) return HttpResponseRedirect(self.get_success_url()) diff --git a/ip_pool/tests.py b/ip_pool/tests.py index f28d910..f8d3fd8 100644 --- a/ip_pool/tests.py +++ b/ip_pool/tests.py @@ -42,7 +42,6 @@ class NetworksTestCase(MyBaseTestCase, TestCase): ip_end='192.168.23.254' ) netw.groups.add(self.group.pk) - netw.save() self.network = netw def test_add_network(self): diff --git a/ip_pool/views.py b/ip_pool/views.py index b4e77e6..8552edb 100644 --- a/ip_pool/views.py +++ b/ip_pool/views.py @@ -88,7 +88,6 @@ def network_in_groups(request, net_id): gr = request.POST.getlist('gr') network.groups.clear() network.groups.add(*gr) - network.save() messages.success(request, _('Successfully saved')) return redirect('ip_pool:net_groups', net_id) diff --git a/tariff_app/tests.py b/tariff_app/tests.py index 84cc318..fd9513f 100644 --- a/tariff_app/tests.py +++ b/tariff_app/tests.py @@ -42,7 +42,6 @@ class ServiceTestCase(MyBaseTestCase, TestCase): calc_type='Df' ) trf.groups.add(self.group.pk) - trf.save() self.tariff = trf def test_add_same_services(self):