Commit 918241b8 authored by Stauros Kroustouris's avatar Stauros Kroustouris

fix bug that would repeatedly commit jobs

parent fbcd63b0
......@@ -3,7 +3,6 @@
Updates and enhancements. Check documentation for updating from previous versions
- Rest Api
- Use Django signals for notifications
=======
1.1.1 RELEASE
......
......@@ -21,7 +21,6 @@ from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.db.models.signals import post_save
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
......@@ -585,16 +584,3 @@ def send_message(msg, user):
tube_message = json.dumps({'message': str(msg), 'username':peer})
b.put(tube_message)
b.close()
def notify_user(sender, instance, created, **kwargs):
if created:
instance.commit_add()
else:
if instance.has_expired():
instance.commit_delete()
else:
instance.commit_edit()
post_save.connect(notify_user, sender=Route)
......@@ -216,6 +216,7 @@ def add_route(request):
route.destination = IPNetwork('%s/%s' % (IPNetwork(route.destination).network.compressed, IPNetwork(route.destination).prefixlen)).compressed
route.requesters_address = request.META['HTTP_X_FORWARDED_FOR']
route.save()
route.commit_add()
form.save_m2m()
return HttpResponseRedirect(reverse("group-routes"))
else:
......@@ -292,6 +293,7 @@ def edit_route(request, route_slug):
route.destination = IPNetwork('%s/%s' % (IPNetwork(route.destination).network.compressed, IPNetwork(route.destination).prefixlen)).compressed
route.requesters_address = self.request.META['HTTP_X_FORWARDED_FOR']
route.save()
route.commit_edit()
if bool(set(changed_data) & set(critical_changed_values)) or (not route_original.status == 'ACTIVE'):
form.save_m2m()
# route.commit_edit()
......@@ -350,7 +352,7 @@ def delete_route(request, route_slug):
route.response = "Deactivating"
route.requesters_address = request.META['HTTP_X_FORWARDED_FOR']
route.save()
# route.commit_delete()
route.commit_delete()
html = "<html><body>Done</body></html>"
return HttpResponse(html)
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment