|
@@ -9,6 +9,7 @@ from coin.offers.models import OfferSubscription
|
|
|
from django.db.models.signals import post_save, post_delete
|
|
|
from django.core.exceptions import ObjectDoesNotExist
|
|
|
from django.dispatch import receiver
|
|
|
+from django.conf import settings
|
|
|
|
|
|
from coin.resources.models import IPSubnet
|
|
|
|
|
@@ -139,21 +140,19 @@ def subnet_event(sender, **kwargs):
|
|
|
config.subnet_event()
|
|
|
|
|
|
offer = config.offersubscription.offer.name
|
|
|
- subref = config.offersubscription.get_subscription_reference()
|
|
|
+ ref = config.offersubscription.get_subscription_reference()
|
|
|
member = config.offersubscription.member
|
|
|
ip = subnet.inet
|
|
|
|
|
|
if kwargs['signal_type'] == "save":
|
|
|
- msg = "Allocating IP %s to member %s (%s - %s %s) (for offer %s, %s)"
|
|
|
+ msg = "[Allocating IP] " + settings.IP_ALLOCATION_MESSAGE
|
|
|
elif kwargs['signal_type'] == "delete":
|
|
|
- msg = "Deallocating IP %s from member %s (%s - %s %s) (was offer %s, %s)"
|
|
|
+ msg = "[Deallocating IP] " + settings.IP_ALLOCATION_MESSAGE
|
|
|
else:
|
|
|
# Does not happens
|
|
|
msg = ""
|
|
|
|
|
|
- subnet_log.info(msg % (ip, str(member.pk),
|
|
|
- member.username, member.first_name, member.last_name,
|
|
|
- offer, subref))
|
|
|
+ subnet_log.info(msg.format(ip=ip, member=member, offer=offer, ref=ref))
|
|
|
|
|
|
except ObjectDoesNotExist:
|
|
|
pass
|