Browse Source

Remove unnecessary save after manytomany add

devel
Dmitry Novikov 8 years ago
parent
commit
30bda2b621
  1. 1
      abonapp/migrations/0002_auto_20180808_1448.py
  2. 4
      abonapp/tests.py
  3. 1
      accounts_app/views.py
  4. 1
      ip_pool/tests.py
  5. 1
      ip_pool/views.py
  6. 1
      tariff_app/tests.py

1
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'])

4
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):

1
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())

1
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):

1
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)

1
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):

Loading…
Cancel
Save