~bnrubin/bantrackertwo/devel

« back to all changes in this revision

Viewing changes to bt/models.py

  • Committer: Benjamin Rubin
  • Date: 2009-08-10 16:53:45 UTC
  • Revision ID: bnrubin@romulus-20090810165345-c6en6tdw7k6rydfh
- Comments now are part of the parent Event to make templating easier
- Began some basic template work

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    channel = models.CharField(max_length=255)
30
30
    log = models.ForeignKey('Log')
31
31
    operator = models.ForeignKey('Operator')
32
 
    hostmask = models.CharField(max_length=255) 
 
32
    hostmask = models.CharField(max_length=255)
 
33
    comments = generic.GenericRelation('Comment') 
33
34
    
34
35
    def __unicode__(self):
35
36
        return self.hostmask
42
43
    mask = models.CharField(max_length=255)
43
44
    removal_date = models.DateTimeField(null = True)
44
45
    removed_by = models.ForeignKey('Operator', null = True)
45
 
    comments = generic.GenericRelation('Comment')
 
46
    
46
47
    
47
48
    def is_removed(self):
48
49
        return self.removal_date != None
54
55
        return re.compile(self.mask.replace('?','.').replace('*','.*'))
55
56
   
56
57
class Kick(Event):
57
 
    reason = models.CharField(max_length=255,null = True)
58
 
    comments = generic.GenericRelation('Comment')    
 
58
    reason = models.CharField(max_length=255,null = True) 
59
59
    def __unicode__(self):
60
60
        return self.hostmask
61
61
    
62
62
class Mark(Event):
63
63
    reason = models.CharField(max_length=255)
64
 
    comments = generic.GenericRelation('Comment')
65
64
    def __unicode__(self):
66
65
        return self.reason
67
66
 
101
100
models.signals.post_save.connect(user_post_save, sender=User)
102
101
    
103
102
class Comment(models.Model):
104
 
    create_date = models.DateTimeField(auto_now_add = True)
 
103
    create_date = models.DateTimeField(null=True)
105
104
    modify_date = models.DateTimeField(auto_now = True)
106
105
    author = models.ForeignKey('Operator')
107
106
    text = models.TextField()