天道酬勤,学无止境

datafield

使用带有数据字段的实际数据时间和生日在 Django 模板中定义年龄(Define age in django template using actual datatime and birthday with datafield)

问题 我是 django 的初学者,并试图为我的用户群中的每个用户显示年龄。 这是我的代码: 模型.py: class Cv(models.Model): author = models.ForeignKey('auth.User') name = models.CharField(max_length=25, null = True) surname = models.CharField(max_length=25, null = True) address = models.CharField(max_length=100, blank=True) telephone = models.IntegerField() birth_date = models.DateField(blank=True, null=True) email = models.EmailField(max_length=50, null=True) skills = models.TextField(null=True) specialization = models.CharField(max_length=30, blank=True, null=True) interests = models.TextField(blank=True, null=True) summary = models

2021-09-30 12:47:27    分类:技术分享    python   django   datafield

Define age in django template using actual datatime and birthday with datafield

i'm begginer at django and trying to display age for every user in my base of users. Here's my code: models.py: class Cv(models.Model): author = models.ForeignKey('auth.User') name = models.CharField(max_length=25, null = True) surname = models.CharField(max_length=25, null = True) address = models.CharField(max_length=100, blank=True) telephone = models.IntegerField() birth_date = models.DateField(blank=True, null=True) email = models.EmailField(max_length=50, null=True) skills = models.TextField(null=True) specialization = models.CharField(max_length=30, blank=True, null=True) interests =

2021-06-26 15:22:30    分类:问答    python   django   datafield

VARCHAR vs TEXT in MySQL

I have two fields: one to store an excerpt with a max size of 500 characters, and another to store a description with a max size of 10,000 characters. What data types should I use, TEXT or VARCHAR? And why? After MySQL 5.0.3 VARCHAR accepts ~65000 characters. But this does not tell why I should use one type and or the other. I'm reasoning that I should use VARCHAR for the excerpt because I can assign a size limit, and TEXT for the description field as it's larger.

2021-04-04 15:14:20    分类:问答    mysql   database   datafield