flake 8 compliance + fix wish/item bug

This commit is contained in:
Fred 2015-12-06 21:11:34 +01:00
parent a87f3982e9
commit 683729be29
1 changed files with 10 additions and 3 deletions

View File

@ -3,13 +3,15 @@ from django.contrib.auth.models import User
import uuid
class Wishlist(models.Model):
name = models.CharField(max_length=255)
description = models.TextField()
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
external_id = models.UUIDField(unique=True, default=uuid.uuid4, editable=False)
external_id = models.UUIDField(unique=True, default=uuid.uuid4,
editable=False)
@staticmethod
def create(name, description):
@ -19,6 +21,7 @@ class Wishlist(models.Model):
w.save()
return w
class Wish(models.Model):
wishlist = models.ForeignKey(Wishlist, related_name='items')
@ -30,17 +33,21 @@ class Wish(models.Model):
numbers_available = models.IntegerField(default=1)
number_of_parts = models.IntegerField(null=True)
estimated_price = models.DecimalField(max_digits=19, decimal_places=2,
null=True)
null=True)
@staticmethod
def create(name, description, wishlist):
i = Item()
i = Wish()
i.name = name
i.description = description
i.wishlist = wishlist
i.save()
return i
class Part(models.Model):
wish = models.ForeignKey('Wish')
user = models.ForeignKey(User)
def save(self, force_insert=False, force_update=False, commit=True):
pass