class Program(models.Model): name = models.CharField(max_length = 45) short_name = models.CharField(max_length = 5) start_date = models.DateField() end_date = models.DateField() city = models.CharField(max_length = 45) description = models.TextField() in_charge = models.CharField(max_length = 45) tag = models.ManyToManyField('Tag') company = models.ManyToManyField('Company') contact = models.ManyToManyField('Contact')
class Trash(models.Model): name = models.CharField() desc = models.CharField() img_src = models.ImageField() html = models.CharField() category = models.CharField(max_length=1) # def throw(self, nm, dsc, img, html, cat): # name = nm # desc = dsc # img_src = img # html = html # category = cat
class UserLoginform(models.model): username = models.CharField(max_length=10) mob_no = models.IntegerField(null=True) email = models.TextField(max_length=10) password = models.PasswordField(max_length=8) def __unicode__(self): return str(self.username)
class TestModelAbstractWithMetaWithoutVerboseName(Model): new_field = models.CharField(max_length=10) class Meta: abstract = True def __str__(self): return self.new_field
class TestModel1(models.Model): new_field = models.CharField(max_length=10) @property def my_brand_new_property(self): return 1 def my_beautiful_method(self): return 2
class TestModelWithMeta(Model): new_field = models.CharField(max_length=10) class Meta: a, b = 1 verbose_name = 'test model' verbose_name_plural = 'test models' def __str__(self): return self.new_field
class User(models.ModelForm): name = models.CharField(max_length=255) email = models.EmailField() class Meta: model = User fields = ('name', ) def test_method_doesnt_error(self): pass
class IceCreamOrder(models.Model): class FLAVORS(Enum): chocolate = ('ch', 'Chocolate') vanilla = ('vn', 'Vanilla') strawberry = ('st', 'Strawberry') chunky_munky = ('cm', 'Chunky Munky') @classmethod def get_value(cls, member): return cls[member].value[0] flavor = models.CharField(max_length=2, choices=[x.value for x in FLAVORS])
class TestModel3(Model): new_field = models.CharField(max_length=10) class Meta: abstract = False @property def my_brand_new_property(self): return 1 def my_beautiful_method(self): return 2
class IceCreamOrder(models.Model): FLAVOR_CHOCOLATE = 'ch' FLAVOR_VANILLA = 'vn' FLAVOR_STRAWBERRY = 'st' FLAVOR_CHUNKY_MUNKY = 'cm' FLAVOR_CHOICES = ((FLAVOR_CHOCOLATE, 'Chocolate'), (FLAVOR_VANILLA, 'Vanilla'), (FLAVOR_STRAWBERRY, 'Strawberry'), (FLAVOR_CHUNKY_MUNKY, 'Chunky Munky')) flavor = models.CharField(max_length=2, choices=FLAVOR_CHOICES)
class TestModel1(models.Model): new_field = models.CharField(max_length=10) class Meta: verbose_name = 'test model' verbose_name_plural = 'test models' @property def my_brand_new_property(self): return 1 def my_beautiful_method(self): return 2
class AbstractTestModel1(Model): new_field = models.CharField(max_length=10) class Meta: abstract = True def __str__(self): return self.new_field @property def my_brand_new_property(self): return 1 def my_beautiful_method(self): return 2
class Account(models.Model): public_key = models.CharField(max_length=1024) balance = models.IntegerField()
class TipoDoc(models.Model): name = models.CharField(max_length=65) afectacion = models.IntegerField(choices=AFECTACIONES)
class Cliente(models.Model): identificacion = models.CharField(max_length=14, help_text="numero ruc")