small fixes to ircbot
This commit is contained in:
parent
330ab25bd3
commit
2ecda214ce
|
@ -1,6 +1,7 @@
|
|||
import irc3
|
||||
from ircbot.models import OutgoingIrcMessage
|
||||
from django.conf import settings
|
||||
from django.utils import timezone
|
||||
|
||||
|
||||
@irc3.plugin
|
||||
|
@ -73,7 +74,7 @@ class Plugin(object):
|
|||
the target channel. Messages are skipped if the bot is not in the channel.
|
||||
"""
|
||||
print("inside get_outgoing_messages()")
|
||||
for msg in OutgoingIrcMessage.objects.filter(processed=False).order_by('created_date'):
|
||||
for msg in OutgoingIrcMessage.objects.filter(processed=False).order_by('created'):
|
||||
# if this message expired mark it as expired and processed without doing anything
|
||||
if msg.timeout < timezone.now():
|
||||
# this message is expired
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from django.core.exceptions import ValidationError
|
||||
from utils.models import UUIDModel, CreatedUpdatedModel
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
|
||||
|
||||
class OutgoingIrcMessage(CreatedUpdatedModel):
|
||||
|
|
|
@ -11,7 +11,12 @@ class CleanedModel(models.Model):
|
|||
try:
|
||||
# call this models full_clean() method before saving,
|
||||
# which in turn calls .clean_fields(), .clean() and .validate_unique()
|
||||
self.full_clean()
|
||||
#self.full_clean()
|
||||
# for some reason self.full_clean() appears to call self.clean() before self.clean_fields()
|
||||
# which is not supposed to happen. Call them manually one by one instead.
|
||||
self.clean_fields()
|
||||
self.clean()
|
||||
self.validate_unique()
|
||||
except ValidationError as e:
|
||||
message = "Got ValidationError while saving: %s" % e
|
||||
if hasattr(self, 'request'):
|
||||
|
|
Loading…
Reference in a new issue