diff options
author | luxagraf <sng@luxagraf.net> | 2018-01-21 11:08:43 -0700 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2018-01-21 11:08:43 -0700 |
commit | 342e3f0450f2a13fe3f2c99d0cc28d053592293e (patch) | |
tree | fb58e7b2b3a1659315162bf7028fd94afd888b6b /app/expenses/models.py | |
parent | 7dbb0c01c941f933914ff0f0d5567a4a7ac7e99c (diff) |
updated code to work with django 2.0
Diffstat (limited to 'app/expenses/models.py')
-rw-r--r-- | app/expenses/models.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/expenses/models.py b/app/expenses/models.py index ff33844..fbcdd7a 100644 --- a/app/expenses/models.py +++ b/app/expenses/models.py @@ -1,5 +1,5 @@ from django.db import models -from django.core.urlresolvers import reverse +from django.urls import reverse from django.utils import timezone CATS = ( @@ -37,7 +37,7 @@ class Month(models.Model): class LuxExpense(models.Model): category = models.CharField(max_length=2, choices=CATS, default=1) amount = models.DecimalField(max_digits=8, decimal_places=2) - month = models.ForeignKey(Month, null=True) + month = models.ForeignKey(Month, on_delete=models.CASCADE, null=True) def __str__(self): return '%s-%s' %(self.month, self.get_category_display()) @@ -50,7 +50,7 @@ class Expense(models.Model): date = models.DateTimeField(default=timezone.now) notes = models.TextField(null=True, blank=True) category = models.CharField(max_length=2, choices=CATS, default=1) - trip = models.ForeignKey(Trip, null=True) + trip = models.ForeignKey(Trip, on_delete=models.CASCADE, null=True) class Meta: ordering = ('-date',) |