~arvindsraj-deactivatedaccount/bantrackertwo/paranthesis-mismatch-bt-models.py

« back to all changes in this revision

Viewing changes to bt/models.py

  • Committer: Benjamin Rubin
  • Date: 2009-11-26 04:02:30 UTC
  • Revision ID: bnrubin@romulus-20091126040230-9n30u2wao8jebqte
- nickname is now shown instead of username for comments
- Added legacy flag for old events
- Paths adjusted for bot compatibilty

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
    log = models.ForeignKey('Log')
41
41
    operator = models.ForeignKey('Operator')
42
42
    hostmask = models.CharField(max_length=255)
 
43
    legacy = models.BooleanField(default=False)
43
44
    
44
45
    def __unicode__(self):
45
46
        return self.hostmask
92
93
class UserProfile(models.Model):
93
94
    user = models.ForeignKey(User, unique = True, editable=False)
94
95
    nickname = models.CharField(max_length=255)
95
 
    hostmask = models.CharField(max_length=255,null=True) # Will need to figure out how to lock this down, so that people cannot assign themselves *!*@*
 
96
    host = models.CharField(max_length=255,null=True)
96
97
    timezone = models.CharField(max_length=100,choices=TZ_CHOICES,null=True)
97
98
    
98
 
    def hostmask_pattern(self):
99
 
        return re.compile(self.hostmask.replace('?','.').replace('*','.*'))  
100
 
    
101
99
    def __unicode__(self):
102
 
        return self.user.nickname
 
100
        return self.nickname
103
101
 
104
 
class UserProfileForm(ModelForm):
105
 
    class Meta:
106
 
        model = UserProfile
107
 
        fields = ('hostmask','timezone')
108
 
    
109
102
class Operator(models.Model):
110
103
    user = models.ForeignKey(User, null = True)
111
104
    host = models.CharField(max_length=255, null = True)