Skip to content

Instantly share code, notes, and snippets.

@katiayn
Last active January 23, 2017 21:43
Show Gist options
  • Save katiayn/7a19ba13809fe6d2c301cb4398814cfc to your computer and use it in GitHub Desktop.
Save katiayn/7a19ba13809fe6d2c301cb4398814cfc to your computer and use it in GitHub Desktop.
from django.db import models
from django.utils.translation import ugettext as _
class Product(models.Model):
name = models.CharField(max_length=255, verbose_name='Name', blank=True)
price = models.DecimalField(
_('Price'),
max_digits=5,
decimal_places=2,
blank=True,
null=True
)
vat = models.IntegerField(_('Vat'), blank=True, null=True)
def set_vat_20(self):
self.vat = 20
self.save()
class ProductQuestionnaire(models.Model):
product = models.ForeignKey(
Product, blank=True, null=True, verbose_name='Product'
)
is_biscuit = models.BooleanField(
default=False, verbose_name='Biscuit?'
)
is_coated_in_chocolate = models.BooleanField(
default=False, verbose_name='Coated in Chocolate?'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment