ircbot: force lowercase IrcChannel channel name
This commit is contained in:
parent
d9c39d3db9
commit
f513b241d2
|
@ -0,0 +1,20 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import models, migrations
|
||||||
|
import ircbot.models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('ircbot', '0012_ircchannel_markov_learn_from_channel'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='ircchannel',
|
||||||
|
name='name',
|
||||||
|
field=ircbot.models.LowerCaseCharField(unique=True, max_length=200),
|
||||||
|
),
|
||||||
|
]
|
|
@ -13,6 +13,14 @@ from django.utils import timezone
|
||||||
log = logging.getLogger('ircbot.models')
|
log = logging.getLogger('ircbot.models')
|
||||||
|
|
||||||
|
|
||||||
|
class LowerCaseCharField(models.CharField):
|
||||||
|
def get_prep_value(self, value):
|
||||||
|
value = super(LowerCaseCharField, self).get_prep_value(value)
|
||||||
|
if value is not None:
|
||||||
|
value = value.lower()
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
class Alias(models.Model):
|
class Alias(models.Model):
|
||||||
|
|
||||||
"""Allow for aliasing of arbitrary regexes to normal supported commands."""
|
"""Allow for aliasing of arbitrary regexes to normal supported commands."""
|
||||||
|
@ -58,7 +66,7 @@ class IrcChannel(models.Model):
|
||||||
|
|
||||||
"""Track channel settings."""
|
"""Track channel settings."""
|
||||||
|
|
||||||
name = models.CharField(max_length=200, unique=True)
|
name = LowerCaseCharField(max_length=200, unique=True)
|
||||||
autojoin = models.BooleanField(default=False)
|
autojoin = models.BooleanField(default=False)
|
||||||
|
|
||||||
topic_msg = models.TextField(default='', blank=True)
|
topic_msg = models.TextField(default='', blank=True)
|
||||||
|
|
Loading…
Reference in New Issue