twitter: add field for mentions output channel

this removes an old, general field, which was once used for multiple
things, but we should break apart its functional usage and also just
refer to our IrcChannel object anyway

this is the easy half of issue #3
This commit is contained in:
Brian S. Stephan 2016-01-24 17:50:46 -06:00
parent e25b3aca9d
commit 352ce81bc9
2 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ircbot', '0014_auto_20160116_1955'),
('twitter', '0003_auto_20150620_0951'),
]
operations = [
migrations.RemoveField(
model_name='twitterclient',
name='output_channel',
),
migrations.AddField(
model_name='twitterclient',
name='mentions_output_channel',
field=models.ForeignKey(blank=True, related_name='mentions_twitter_client', null=True, to='ircbot.IrcChannel', default=None),
),
]

View File

@ -4,6 +4,8 @@ import logging
from django.db import models
from ircbot.models import IrcChannel
log = logging.getLogger('twitter.models')
@ -13,10 +15,12 @@ class TwitterClient(models.Model):
"""Track twitter settings and similar."""
since_id = models.PositiveIntegerField()
output_channel = models.CharField(max_length=200, default='', blank=True)
oauth_token = models.CharField(max_length=256, default='', blank=True)
oauth_token_secret = models.CharField(max_length=256, default='', blank=True)
mentions_output_channel = models.ForeignKey(IrcChannel, related_name='mentions_twitter_client', default=None,
null=True, blank=True)
class Meta:
permissions = (
('send_tweets', "Can send tweets via IRC"),