58 lines
1.9 KiB
Python
58 lines
1.9 KiB
Python
from . import models
|
|
from django.forms import ModelForm
|
|
|
|
|
|
class AntiSpam(ModelForm):
|
|
class Meta:
|
|
model = models.GroupPreferences
|
|
fields = ['combot_anti_spam_use',
|
|
'combot_anti_spam_leave_mess',
|
|
'combot_anti_spam_notification',
|
|
]
|
|
labels = {
|
|
'combot_anti_spam_use': 'Use Combot Anti-Spam System (CAS)',
|
|
'combot_anti_spam_leave_mess': 'Keep join message',
|
|
'combot_anti_spam_notification': 'Send message mentioning that a spammer was banned',
|
|
}
|
|
help_texts = {
|
|
'combot_anti_spam_use': 'By doing so, you understand that you will have to comply with their conditions.',
|
|
'combot_anti_spam_leave_mess': 'If checked, spammer\'s join message will not be deleted.',
|
|
'combot_anti_spam_notification': 'Leave it empty to disable. Use {NAME} to display the known spammer\'s name instead.',
|
|
}
|
|
error_messages = {
|
|
'combot_anti_spam_notification': {
|
|
'max_length': "This writer's name is too long.",
|
|
},
|
|
}
|
|
|
|
|
|
class CAPTCHA(ModelForm):
|
|
class Meta:
|
|
model = models.GroupPreferences
|
|
fields = ['captcha_use',
|
|
'captcha_chars',
|
|
'captcha_digits',
|
|
'captcha_timeout',
|
|
'captcha_attempts',
|
|
'captcha_first_message',
|
|
'captcha_retry_message',
|
|
'captcha_leave_mess',
|
|
'captcha_generate',
|
|
]
|
|
|
|
|
|
class Greetings(ModelForm):
|
|
class Meta:
|
|
model = models.GroupPreferences
|
|
fields = ['join_message',
|
|
'leave_message',
|
|
]
|
|
|
|
|
|
class CannedMessage(ModelForm):
|
|
class Meta:
|
|
model = models.GroupCannedMessage
|
|
fields = ['listen',
|
|
'reply_with',
|
|
]
|