mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Fixed issues with __unicode__() becoming __str__() in Python 3.
Fixed recursion issue with VatRate
This commit is contained in:
@@ -43,11 +43,11 @@ def import_people():
|
||||
person, created = models.Person.objects.get_or_create(pk=row[0], name=row[1], phone=row[2], email=email,
|
||||
address=row[4], notes=notes)
|
||||
if created:
|
||||
print("Created: " + person.__unicode__())
|
||||
print("Created: " + person.__str__())
|
||||
with transaction.atomic(), reversion.create_revision():
|
||||
person.save()
|
||||
else:
|
||||
print("Found: " + person.__unicode__())
|
||||
print("Found: " + person.__str__())
|
||||
|
||||
|
||||
def import_organisations():
|
||||
@@ -65,11 +65,11 @@ def import_organisations():
|
||||
address=row[3],
|
||||
union_account=row[4], notes=notes)
|
||||
if created:
|
||||
print("Created: " + object.__unicode__())
|
||||
print("Created: " + object.__str__())
|
||||
with transaction.atomic(), reversion.create_revision():
|
||||
object.save()
|
||||
else:
|
||||
print("Found: " + object.__unicode__())
|
||||
print("Found: " + object.__str__())
|
||||
|
||||
|
||||
def import_vat_rates():
|
||||
@@ -83,11 +83,11 @@ def import_vat_rates():
|
||||
object, created = models.VatRate.objects.get_or_create(pk=row[0], start_at=start_at,
|
||||
comment=row[3], rate=row[4])
|
||||
if created:
|
||||
print("Created: " + object.__unicode__())
|
||||
print("Created: " + object.__str__())
|
||||
with transaction.atomic(), reversion.create_revision():
|
||||
object.save()
|
||||
else:
|
||||
print("Found: " + object.__unicode__())
|
||||
print("Found: " + object.__str__())
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -38,7 +38,7 @@ class Person(models.Model, RevisionMixin):
|
||||
|
||||
notes = models.TextField(blank=True, null=True)
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
string = self.name
|
||||
if len(self.notes) > 0:
|
||||
string += "*"
|
||||
@@ -55,7 +55,7 @@ class Organisation(models.Model, RevisionMixin):
|
||||
notes = models.TextField(blank=True, null=True)
|
||||
union_account = models.BooleanField(default=False)
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
string = self.name
|
||||
if len(self.notes) > 0:
|
||||
string += "*"
|
||||
@@ -68,8 +68,9 @@ class VatRate(models.Model, RevisionMixin):
|
||||
rate = models.DecimalField(max_digits=6, decimal_places=6)
|
||||
comment = models.CharField(max_length=255)
|
||||
|
||||
@property
|
||||
def as_percent(self):
|
||||
return self.rate * 100
|
||||
return (self.rate * 100)
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return self.comment + " " + str(self.start_at) + " @ " + str(self.as_percent) + "%"
|
||||
|
||||
Reference in New Issue
Block a user