from django db import models from django contrib import auth class Art

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
from django.db import models
from django.contrib import auth
class Article(models.Model):
title=models.CharField(maxlength=120)
pub_date=models.DateTimeField('Publication date',auto_now_add=True)
mod_date=models.DateTimeField('Modification date',auto_now=True)
publisher=models.ForeignKey(auth.models.User)
content=models.TextField()
class Admin:
pass
def __unicode__(self):
return u"<Article %(title)r by %(publisher)r>" %self.__dict__