Esempio n. 1
0
 class Meta:
     verbose_name = _("profile")
     verbose_name_plural = _("profiles")
     permissions = (
             ('available_for_call_duty', _nl("Available for call duty")), # for workers
             ('free_coffee_unlimited', _nl("Unlimited free coffee")),
             ('free_coffee_with_cooldown', _nl("Free coffee with cooldown")),
             )
Esempio n. 2
0
 class Meta:
     verbose_name = _("shift sign-up")
     verbose_name_plural = _("shift sign-ups")
     ordering = ('-shift__when',)
     permissions = (
             ('self_and_friend_signup', _nl("Can sign up self and friends")), # for workers
             )
Esempio n. 3
0
 class Meta:
     verbose_name = _("semester")
     verbose_name_plural = _("semesters")
     permissions = (('manage_job_openings',
                     _nl("Can manage job openings")), )
Esempio n. 4
0
translation_module_2.ungettext('tm2_untest', 'tm2_untests', 42)
translation_module_2.ungettext_lazy('tm2_untest_lazy', 'tm2_untests_lazy', 42)
translation_module_2.npgettext('context', 'tm2_nptest', 'tm2_nptests', 42)
translation_module_2.npgettext_lazy('context', 'tm2_nptest_lazy',
                                    'tm2_nptests_lazy', 42)

_('alias_test')
_l('alias_test_lazy')
_0x90('alias_test_noop')
_u('alias_utest')
_ul('alias_utest_lazy')
_u0x90('alias_utest_noop')
_p('context', 'alias_ptest')
_pl('context', 'alias_ptest_lazy')
_n('alias_ntest', 'alias_ntests', 42)
_nl('alias_ntest_lazy', 'alias_ntests_lazy', 42)
_un('alias_untest', 'alias_untests', 42)
_unl('alias_untest_lazy', 'alias_untests_lazy', 42)
_np('context', 'alias_nptest', 'alias_nptests', 42)
_npl('context', 'alias_nptest_lazy', 'alias_nptests_lazy', 42)


def gettext(message):
    pass


gettext('not a translation')


def some_function():
    from django.utils.translation import gettext
Esempio n. 5
0
    def __del__(self):
        # clean up the default avatar again when this object is destroyed
        self.__class__.defaultAvatar = None

    @classmethod
    def isDefaultAvatar(cls, data):
        """
        Returns True if the provided data is the default avatar.
        """
        if cls.defaultAvatar is not None and cls.defaultAvatar == data:
            return True
        else:
            return False


custom_image_help_text = _nl("Please make sure that you don't violate any copyright by uploading an image. "
                             "Also keep in mind that any previous metadata of the image will be removed.")


class CustomImageField(ImageField):
    widget = CustomClearableFileInput

    def __init__(self, *args, **kwargs):
        kwargs["required"] = False
        kwargs["help_text"] = "<div class='alert alert-warning'><b>NOTE:</b> " + custom_image_help_text + "</div>"
        super(CustomImageField, self).__init__(*args, **kwargs)

    def to_python(self, data):
        # return the data if it is the default avatar
        if CustomClearableFileInput.isDefaultAvatar(data):
            self.validators = []
            return data
Esempio n. 6
0
        }


class CommentForm(ModelForm):
    text = CharField(
        widget=PagedownWidget(attrs={'rows': 3},
                              css=("pagedown/demo/browser/demo.css",
                                   "css/pagedown.css")))

    class Meta:
        model = Comment
        fields = ['text']


attachment_help_text = _nl(
    "Please make sure that you don't violate any copyright by uploading files. "
    "Also keep in mind that any previous metadata of images will be removed.")


class AttachmentForm(ModelForm):
    class Meta:
        model = Attachment
        fields = ['file']
        help_texts = {
            'file': ("<div class='alert alert-warning'><b>NOTE:</b> " +
                     attachment_help_text + "</div>")
        }

    def clean_file(self):
        cleaned_file = self.cleaned_data['file']
        # if the file is an image the metadata is stripped