手记

pycharm 自定义快速生成代码

Editor-->Live Templates

Django Model
1、model:python-->other
class $ClassName$(models.Model):

    # models.AutoField(primary_key=True)
    # models.IntegerField(verbose_name="")
    # models.CharField(max_length=32, verbose_name="")
    # models.ImageField(upload_to="type", verbose_name="")
    # models.ForeignKey("", on_delete=models.CASCADE, verbose_name="")
    # models.BooleanField(default=False, verbose_name="")
    # models.DecimalField(max_digits=10, decimal_places=2, verbose_name="")

    # create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    # update_time = models.DateTimeField(auto_now=True, verbose_name='更新时间')

    def __str__(self):
        return ""

    class Meta:
        db_table = ""
        verbose_name = ""
        verbose_name_plural = verbose_name

2、inf:python-->class(左下角选择)
models.IntegerField(verbose_name="$VAL$")

3、cf:python-->class
models.CharField(max_length=32, verbose_name="$VAL$")

4、fk:python-->class
models.ForeignKey("", on_delete=models.CASCADE, verbose_name="")

5、bf:python-->class
models.BooleanField(default=False, verbose_name="")

6、vc:python-->other
class $className$(View):

    def get(self, request):
        return render(request, '')

    def post(self, request):
        pass

7、vd:python-->other
def $defName$(request):
    return render(request, '')


0人推荐
随时随地看视频
慕课网APP