zoukankan      html  css  js  c++  java
  • bbs网站 models

    bbs网站 models #!/usr/bin/env python #_*_coding:utf-8_*_ from django.db import models from django.contrib.auth.models import User # Create your models here. class Article(models.Model): title = models.CharField(max_length=254) category = models.ForeignKey('Category') conetent = models.TextField(max_length=100000) author = models.ForeignKey('UserProfile') publish_date = models.DateTimeField(auto_now_add=True) summary = models.TextField(max_length=256) #thumb_ups = models.ForeignKey('ThumbUp',blank=True) #comments = models.ManyToManyField('Comments',blank=True) #head_image = models.ImageField() def __unicode__(self): return self.title class Category(models.Model): name = models.CharField(max_length=64,unique=True) admins = models.ManyToManyField('UserProfile') def __unicode__(self): return self.name class ThumbUp(models.Model): article = models.ForeignKey('Article') user = models.ForeignKey('UserProfile') date = models.DateTimeField(auto_now_add=True) def __unicode__(self): return self.article class UserProfile(models.Model): user = models.OneToOneField(User) name = models.CharField(max_length=32) user_groups = models.ManyToManyField('UserGroup') def __unicode__(self): return self.name class UserGroup(models.Model): name = models.CharField(max_length=64,unique=True) def __unicode__(self): return self.name class Comments(models.Model): article = models.ForeignKey('Article') user = models.ForeignKey('UserProfile') parent_comment = models.ForeignKey('Comments',blank=True,null=True,related_name='pid') comment = models.TextField(max_length=1024,) date = models.DateTimeField(auto_now_add=True) def __unicode__(self): return self.article.comments

  • 相关阅读:
    实用硬件篇(一)
    iOS通讯录(纯纯的干货)
    iOS社会化分享(干货)
    静态库的打包及使用(干货)
    iOS地图集成示例:百度地图POI检索
    iOS开发之KVC全解
    网络干货
    输入一个字符串,按字典序打印出该字符串中字符的所有排列(剑指offer)
    序列化二叉树
    二叉树中和为某一值的路径
  • 原文地址:https://www.cnblogs.com/fengjian2016/p/5413222.html
Copyright © 2011-2022 走看看