2013-11-28 04:07:30 +08:00
|
|
|
from django.db import models
|
2013-12-01 05:04:34 +08:00
|
|
|
from django.utils.encoding import python_2_unicode_compatible
|
2013-11-28 04:07:30 +08:00
|
|
|
|
|
|
|
|
2013-12-01 05:04:34 +08:00
|
|
|
@python_2_unicode_compatible
|
2013-11-28 04:07:30 +08:00
|
|
|
class Author(models.Model):
|
|
|
|
name = models.CharField(max_length=20)
|
|
|
|
age = models.IntegerField(null=True)
|
|
|
|
birthdate = models.DateField(null=True)
|
2013-12-01 05:04:34 +08:00
|
|
|
average_rating = models.FloatField(null=True)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.name
|