Browse Source

Moving imports at beginning of file

Alexandre Aubin 7 years ago
parent
commit
8684fcdbf3
1 changed files with 3 additions and 5 deletions
  1. 3 5
      coin/billing/models.py

+ 3 - 5
coin/billing/models.py

@@ -6,6 +6,7 @@ import uuid
 import re
 import logging
 from decimal import Decimal
+from dateutil.relativedelta import relativedelta
 
 from django.conf import settings
 from django.db import models, transaction
@@ -14,6 +15,7 @@ from django.utils.encoding import python_2_unicode_compatible
 from django.dispatch import receiver
 from django.db.models.signals import post_save
 from django.core.exceptions import ValidationError
+from django.core.urlresolvers import reverse
 
 
 from coin.offers.models import OfferSubscription
@@ -22,6 +24,7 @@ from coin.html2pdf import render_as_pdf
 from coin.utils import private_files_storage, start_of_month, end_of_month, \
                        postgresql_regexp, send_templated_email
 from coin.isp_database.context_processors import branding
+from coin.isp_database.models import ISPInfo
 
 accounting_log = logging.getLogger("coin.billing")
 
@@ -241,7 +244,6 @@ class Invoice(models.Model):
                 and private_files_storage.exists(self.pdf.name))
 
     def get_absolute_url(self):
-        from django.core.urlresolvers import reverse
         return reverse('billing:invoice', args=[self.number])
 
     def __unicode__(self):
@@ -257,8 +259,6 @@ class Invoice(models.Model):
         if self.status != 'open' or not self.validated:
             return False
 
-        from dateutil.relativedelta import relativedelta
-
         # If bill is not at least one month old, nope
         if self.date_due >= timezone.now()+relativedelta(weeks=-4):
             return False
@@ -285,8 +285,6 @@ class Invoice(models.Model):
         accounting_log.info("Sending reminder email to %s to pay invoice %s"
                            % (str(self.member), str(self.number)))
 
-        from coin.isp_database.models import ISPInfo
-
         isp_info = ISPInfo.objects.first()
         kwargs = {}
         # Il peut ne pas y avir d'ISPInfo, ou bien pas d'administrative_email