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

  • 相关阅读:
    独立安装SharePoint 2013碰到的"SDDL"问题及解决方法
    软件编程21法则
    HtmlAgilityPack 之 HtmlNode类
    SpringBoot集成Hadoop3.1.3
    win10 mysql慢查询
    Java多线程并行计算(Google的Guava使用)
    win10安装hadoop3.1.3
    mapDB的基本用法
    SpringBoot集成JMH
    mysql死锁
  • 原文地址:https://www.cnblogs.com/fengjian2016/p/5413222.html
Copyright © 2011-2022 走看看