Advertisement
Guest User

coercing to Unicode: need string or buffer, NoneType found

a guest
Jul 31st, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.90 KB | None | 0 0
  1. class Variation(models.Model):
  2.     barcode = models.CharField(max_length=255, unique=True, null=True, blank=True,)
  3.     sku = models.CharField(max_length=255, unique=True, null=False, blank=False)
  4.     title = models.CharField(max_length=255, null=False, unique=False)
  5.     price = models.DecimalField(max_digits=5, decimal_places=2, null=True, blank=True)
  6.     cost = models.DecimalField(max_digits=5, decimal_places=2, null=True, blank=True)
  7.     stock_level = models.IntegerField(null=False, blank=False)
  8.     weight = models.DecimalField(null=True, blank=True, max_digits=5, decimal_places=5)
  9.     height = models.DecimalField(null=True, blank=True, max_digits=5, decimal_places=5)
  10.     width = models.DecimalField(null=True, blank=True, max_digits=5, decimal_places=5)
  11.     length = models.DecimalField(null=True, blank=True, max_digits=5, decimal_places=5)
  12.     is_master = models.BooleanField()
  13.     image_id = models.IntegerField(null=True, blank=True)
  14.     product = models.ForeignKey(Product, related_name='variations') \
  15.         # Reference to Product Model
  16.     created_at = models.DateTimeField(auto_now_add=True)
  17.     updated_at = models.DateTimeField(auto_now=True)
  18.  
  19.     # 'Magic Method'Helps to view instances of a django model.
  20.     def __unicode__(self):  # __str__ on Python 3
  21.         return self.title
  22.  
  23. # Property Table called ExtraField
  24. class ExtraField(models.Model):
  25.     '''
  26.    This Model will hold any extra properity or data associated with any
  27.    specific variation.
  28.    '''
  29.     variation = models.ManyToManyField(Variation)  # reference to Variation
  30.     title = models.CharField(max_length=255)
  31.     description = models.CharField(max_length=255)
  32.     created_at = models.DateTimeField(auto_now_add=True)
  33.     updated_at = models.DateTimeField(auto_now=True)
  34.  
  35.     # 'Magic Method'Helps to view instances of a django model.
  36.     def __unicode__(self):  # __str__ on Python 3
  37.         self self.title
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement