project/kiwipycon/proceedings/models.py
author Madhusudan.C.S <madhusudancs@gmail.com>
Thu, 14 Jan 2010 19:19:34 +0530
changeset 87 1ec579a679e4
parent 84 d01c62c2a628
permissions -rw-r--r--
Added two models, Paper and Attachments.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
84
d01c62c2a628 Added the initial proceedings app files and enabled them in both production and development settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     1
# -*- coding: utf-8 -*-
d01c62c2a628 Added the initial proceedings app files and enabled them in both production and development settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     2
from __future__ import absolute_import
d01c62c2a628 Added the initial proceedings app files and enabled them in both production and development settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     3
d01c62c2a628 Added the initial proceedings app files and enabled them in both production and development settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     4
from django.db import models
d01c62c2a628 Added the initial proceedings app files and enabled them in both production and development settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     5
from django.contrib.auth.models import User
d01c62c2a628 Added the initial proceedings app files and enabled them in both production and development settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     6
d01c62c2a628 Added the initial proceedings app files and enabled them in both production and development settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     7
d01c62c2a628 Added the initial proceedings app files and enabled them in both production and development settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     8
class Paper(models.Model):
d01c62c2a628 Added the initial proceedings app files and enabled them in both production and development settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
     9
    """Data model for storing proceedings paper.
d01c62c2a628 Added the initial proceedings app files and enabled them in both production and development settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    10
    """
d01c62c2a628 Added the initial proceedings app files and enabled them in both production and development settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    11
87
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    12
    # Title of the paper
84
d01c62c2a628 Added the initial proceedings app files and enabled them in both production and development settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    13
    title = models.CharField(max_length=200)
87
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    14
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    15
    # Abstract to be published with the paper
84
d01c62c2a628 Added the initial proceedings app files and enabled them in both production and development settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    16
    abstract = models.TextField()
87
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    17
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    18
    # Body text of the paper
84
d01c62c2a628 Added the initial proceedings app files and enabled them in both production and development settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff changeset
    19
    body = models.TextField()
87
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    20
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    21
    # Authors
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    22
    authors = models.ManyToManyField(User)
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    23
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    24
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    25
class Attachments(models.Model):
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    26
    """Stores attachments for papers.
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    27
    """
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    28
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    29
    # Attachment for generating paper
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    30
    attachments = models.FileField(upload_to='attachments/%Y/%m/%d')
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    31
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    32
    # The paper to which this attachment belongs to
1ec579a679e4 Added two models, Paper and Attachments.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 84
diff changeset
    33
    paper = models.ForeignKey(Paper)