add some text
This commit is contained in:
parent
c955215c17
commit
c1f8c10e10
5 changed files with 145 additions and 0 deletions
62
pandora/text/models.py
Normal file
62
pandora/text/models.py
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
from __future__ import division, with_statement
|
||||
from datetime import datetime
|
||||
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
from django.conf import settings
|
||||
|
||||
import ox
|
||||
from ox.django import fields
|
||||
from ox.utils import json
|
||||
|
||||
|
||||
class News(models.Model):
|
||||
created = models.DateTimeField(auto_now_add=True)
|
||||
modified = models.DateTimeField(auto_now=True)
|
||||
published = models.DateTimeField(default=datetime.now, editable=False)
|
||||
public = models.BooleanField(default=False)
|
||||
|
||||
user = models.ForeignKey(User)
|
||||
slug = models.SlugField()
|
||||
title = models.CharField(null=True, max_length=255)
|
||||
body = models.TextField(default='')
|
||||
|
||||
def __unicode__(self):
|
||||
return u"%s <%s>" % (self.title, self.slug)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return '/text/%s' % self.slug
|
||||
|
||||
class Text(models.Model):
|
||||
created = models.DateTimeField(auto_now_add=True)
|
||||
modified = models.DateTimeField(auto_now=True)
|
||||
published = models.DateTimeField(default=datetime.now, editable=False)
|
||||
public = models.BooleanField(default=False)
|
||||
|
||||
user = models.ForeignKey(User)
|
||||
slug = models.SlugField()
|
||||
title = models.CharField(null=True, max_length=255)
|
||||
body = models.TextField(default='')
|
||||
|
||||
def __unicode__(self):
|
||||
return u"%s <%s>" % (self.title, self.slug)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return '/text/%s' % self.slug
|
||||
|
||||
class Image(models.Model):
|
||||
image = models.ImageField(upload_to='text/image')
|
||||
caption = models.CharField(max_length=255, default="")
|
||||
|
||||
def get_absolute_url(self):
|
||||
return self.image.url
|
||||
|
||||
class Attachment(models.Model):
|
||||
file = models.FileField(upload_to='text/attachment')
|
||||
caption = models.CharField(max_length=255, default="")
|
||||
|
||||
def get_absolute_url(self):
|
||||
return self.file.url
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue