zoukankan      html  css  js  c++  java
  • The Django Book学习笔记 06 admin

    自定义字段标签

    自定义一个标签, 你只需在模块中指定 verbose_name=' '
    from django.db import models
    # Create your models here.
    from django.db import models
    
    class Publisher(models.Model):
        name = models.CharField(max_length=30)
        address = models.CharField(max_length=50)
        city = models.CharField(max_length=60)
        state_province = models.CharField(max_length=30)
        country = models.CharField(max_length=50)
        website = models.URLField()
    
    class Author(models.Model):
        fist_name = models.CharField(max_length=30)
        last_name = models.CharField(max_length=40)
        email = models.EmailField(blank=True)
    
    class Book(models.Model):
        title = models.CharField(max_length=100)
        authors = models.ManyToManyField(Author)
        publisher = models.ForeignKey(Publisher)
        publication_date = models.DateField()
    email = models.EmailField(blank=True, verbose_name='e-mail')

       

  • 相关阅读:
    随笔练习
    获得屏幕相关的辅助类
    C# 下sqlite简单使用
    XP系统下 VS2010 选中行崩溃
    Custome Buble Data Point
    RIA
    Chart Style
    d3js
    TreeView
    [Java入门笔记] Java语言简介
  • 原文地址:https://www.cnblogs.com/zhanhg/p/4392652.html
Copyright © 2011-2022 走看看