23 lines
641 B
Python
23 lines
641 B
Python
|
from django.db import models
|
||
|
|
||
|
class Issue(models.Model):
|
||
|
name = models.CharField(max_length=255)
|
||
|
date = models.DateField()
|
||
|
def __unicode__(self):
|
||
|
return self.name
|
||
|
|
||
|
class Article(models.Model):
|
||
|
author = models.ForeignKey("Contributor", blank=True, null=True)
|
||
|
title = models.CharField(max_length=255)
|
||
|
text = models.TextField()
|
||
|
issue = models.ForeignKey(Issue)
|
||
|
def __unicode__(self):
|
||
|
return self.title + " - " + self.author
|
||
|
|
||
|
class Contributor(models.Model):
|
||
|
name = models.CharField(max_length=255)
|
||
|
email = models.EmailField(blank=True, null=True)
|
||
|
def __unicode__(self):
|
||
|
return self.name + ": " + self.email
|
||
|
|