summaryrefslogtreecommitdiffstats
path: root/news/models.py
blob: fb9acc548ea35504ca2906b64adc9e464cd7e330 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from django.db import models
from django.contrib.auth.models import User

class News(models.Model):
    text = models.TextField()
    title = models.CharField(max_length=300)
    date = models.DateTimeField(auto_now_add=True)
    author = models.ForeignKey(User)

    def __unicode__(self):
        return u'{} - {}'.format(self.title, self.date)

class Comment(models.Model):
    text = models.TextField()
    author = models.ForeignKey(User)
    date = models.DateTimeField(auto_now_add=True)
    news = models.ForeignKey(News)