From 352ce81bc9001ebec056e168630132e9c384db0e Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sun, 24 Jan 2016 17:50:46 -0600 Subject: [PATCH] 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 --- ...4_add_mentions_output_channel_to_config.py | 24 +++++++++++++++++++ dr_botzo/twitter/models.py | 6 ++++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 dr_botzo/twitter/migrations/0004_add_mentions_output_channel_to_config.py diff --git a/dr_botzo/twitter/migrations/0004_add_mentions_output_channel_to_config.py b/dr_botzo/twitter/migrations/0004_add_mentions_output_channel_to_config.py new file mode 100644 index 0000000..f04a04d --- /dev/null +++ b/dr_botzo/twitter/migrations/0004_add_mentions_output_channel_to_config.py @@ -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), + ), + ] diff --git a/dr_botzo/twitter/models.py b/dr_botzo/twitter/models.py index 50425e9..da4037a 100644 --- a/dr_botzo/twitter/models.py +++ b/dr_botzo/twitter/models.py @@ -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"),