* Make Influence.character no longer optional.
[matthijs/projects/xerxes.git] / influences / models.py
1 from django.db import models
2 from django.contrib.auth.models import User
3
4 # Create your models here.
5 class Character(models.Model):
6         created     = models.DateField(auto_now_add=1)
7         modified    = models.DateField(auto_now=1)
8         name        = models.CharField(max_length=255)
9         player      = models.ForeignKey(User)
10
11         def __str__(self):
12                 return self.name
13
14         class Admin:
15                 pass
16
17 class Influence(models.Model):
18         STATUS_CHOICES = (
19                 ('N', 'New'),
20                 ('P', 'Processing'),
21                 ('D', 'Done'),
22         )
23         created     = models.DateField(auto_now_add=1)
24         modified    = models.DateField(auto_now=1)
25         
26         character   = models.ForeignKey(Character, edit_inline=models.TABULAR, num_in_admin=3, core=True)
27         contact     = models.CharField(max_length=255)
28         description = models.TextField()
29         status      = models.TextField(max_length=1, choices=STATUS_CHOICES, default='N')
30         longterm    = models.BooleanField(default=False)
31
32         def __str__(self):
33                 return self.description[0:10]
34
35         class Admin:
36                 pass