]> git.openstreetmap.org Git - osqa.git/blob - forum/settings/users.py
Closes OSQA 320, True Gravatar Support.
[osqa.git] / forum / settings / users.py
1 from forms import CommaStringListWidget
2 from django.forms import CheckboxSelectMultiple
3 from django.forms.widgets import RadioSelect
4 from base import Setting, SettingSet
5 from django.utils.translation import ugettext as _
6
7 USERS_SET = SettingSet('users', _('Users settings'), _("General settings for the OSQA users."), 20)
8
9 EDITABLE_SCREEN_NAME = Setting('EDITABLE_SCREEN_NAME', False, USERS_SET, dict(
10 label = _("Editable screen name"),
11 help_text = _("Allow users to alter their screen name."),
12 required=False))
13
14 MIN_USERNAME_LENGTH = Setting('MIN_USERNAME_LENGTH', 3, USERS_SET, dict(
15 label = _("Minimum username length"),
16 help_text = _("The minimum length (in character) of a username.")))
17
18 RESERVED_USERNAMES = Setting('RESERVED_USERNAMES',
19 [_('fuck'), _('shit'), _('ass'), _('sex'), _('add'), _('edit'), _('save'), _('delete'), _('manage'), _('update'), _('remove'), _('new')]
20 , USERS_SET, dict(
21 label = _("Disabled usernames"),
22 help_text = _("A comma separated list of disabled usernames (usernames not allowed during a new user registration)."),
23 widget=CommaStringListWidget))
24
25 SHOW_STATUS_DIAMONDS = Setting('SHOW_STATUS_DIAMONDS', True, USERS_SET, dict(
26 label=_("Show status diamonds"),
27 help_text = _("Show status \"diamonds\" next to moderators or superusers usernames."),
28 required=False,
29 ))
30
31 EMAIL_UNIQUE = Setting('EMAIL_UNIQUE', True, USERS_SET, dict(
32 label = _("Force unique email"),
33 help_text = _("Should each user have an unique email.")))
34
35 REQUIRE_EMAIL_VALIDATION_TO = Setting('REQUIRE_EMAIL_VALIDATION_TO', [], USERS_SET, dict(
36 label = _("Require email validation to..."),
37 help_text = _("Which actions in this site, users without a valid email will be prevented from doing."),
38 widget=CheckboxSelectMultiple,
39 choices=(("ask", _("ask questions")), ("answer", _("provide answers")), ("comment", _("make comments")), ("flag", _("report posts"))),
40 required=False,
41 ))
42
43 DONT_NOTIFY_UNVALIDATED = Setting('DONT_NOTIFY_UNVALIDATED', True, USERS_SET, dict(
44 label = _("Don't notify to invalid emails"),
45 help_text = _("Do not notify users with unvalidated emails."),
46 required=False))
47
48 HOLD_PENDING_POSTS_MINUTES = Setting('HOLD_PENDING_POSTS_MINUTES', 120, USERS_SET, dict(
49 label=_("Hold pending posts for X minutes"),
50 help_text=_("How much time in minutes a post should be kept in session until the user logs in or validates the email.")
51 ))
52
53 WARN_PENDING_POSTS_MINUTES = Setting('WARN_PENDING_POSTS_MINUTES', 15, USERS_SET, dict(
54 label=_("Warn about pending posts afer X minutes"),
55 help_text=_("How much time in minutes a user that just logged in or validated his email should be warned about a pending post instead of publishing it automatically.")
56 ))
57
58 GRAVATAR_RATING_CHOICES = (
59     ('g', _('suitable for display on all websites with any audience type.')),
60     ('pg', _('may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence.')),
61     ('r', _('may contain such things as harsh profanity, intense violence, nudity, or hard drug use.')),
62     ('x', _('may contain hardcore sexual imagery or extremely disturbing violence.')),
63 )
64
65 GRAVATAR_ALLOWED_RATING = Setting('GRAVATAR_ALLOWED_RATING', 'g', USERS_SET, dict(
66 label = _("Gravatar rating"),
67 help_text = _("Gravatar allows users to self-rate their images so that they can indicate if an image is appropriate for a certain audience."),
68 widget=RadioSelect,
69 choices=GRAVATAR_RATING_CHOICES,
70 required=False))
71
72 GRAVATAR_DEFAULT_CHOICES = (
73     ('mm', _('(mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash)')),
74     ('identicon', _('a geometric pattern based on an email hash')),
75     ('monsterid', _('a generated "monster" with different colors, faces, etc')),
76     ('wavatar', _('generated faces with differing features and backgrounds')),
77 )
78
79 GRAVATAR_DEFAULT_IMAGE = Setting('GRAVATAR_DEFAULT_IMAGE', 'identicon', USERS_SET, dict(
80 label = _("Gravatar default"),
81 help_text = _("Gravatar has a number of built in options which you can also use as defaults."),
82 widget=RadioSelect,
83 choices=GRAVATAR_DEFAULT_CHOICES,
84 required=False))
85