Last active
January 23, 2017 21:43
-
-
Save katiayn/7a19ba13809fe6d2c301cb4398814cfc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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