dr.botzo/dr_botzo/dispatch/models.py

31 lines
696 B
Python
Raw Normal View History

"""Track dispatcher configurations."""
import logging
from django.db import models
log = logging.getLogger('dispatch.models')
class Dispatcher(models.Model):
"""Handle incoming API requests and do something with them."""
PRIVMSG_TYPE = 'privmsg'
FILE_TYPE = 'file'
TYPE_CHOICES = (
(PRIVMSG_TYPE, "IRC privmsg"),
(FILE_TYPE, "Write to file"),
)
key = models.CharField(max_length=16, unique=True)
type = models.CharField(max_length=16, choices=TYPE_CHOICES)
destination = models.CharField(max_length=200)
def __unicode__(self):
"""String representation."""
return u"{0:s} -> {1:s}".format(self.key, self.destination)