Example #1
0
    def __init__(self, request, *args, **kwargs):
        super(AddContestMessageForm, self).__init__(*args, **kwargs)
        self.fields["topic"].widget.attrs["class"] = "input-xxlarge"
        self.fields["content"].widget.attrs["class"] = "input-xxlarge monospace"

        self.request = request

        instance = kwargs.get("instance", None)
        if instance is not None:
            self.fields["category"].choices = get_categories(request)
            self.fields["category"].initial = get_category(instance)
        else:
            self.fields["category"].choices = [("", "")] + get_categories(request)
Example #2
0
    def __init__(self, request, *args, **kwargs):
        super(AddContestMessageForm, self).__init__(*args, **kwargs)
        self.fields['topic'].widget.attrs['class'] = 'input-xxlarge'
        self.fields['content'].widget.attrs['class'] = \
                'input-xxlarge monospace'

        self.request = request

        if 'instance' in kwargs:
            self.fields['category'].choices = get_categories(request)
            self.fields['category'].initial = get_category(kwargs['instance'])
        else:
            self.fields['category'].choices = \
                    [('', '')] + get_categories(request)
Example #3
0
    def __init__(self, request, *args, **kwargs):
        super(AddContestMessageForm, self).__init__(*args, **kwargs)
        self.fields['content'].widget.attrs['class'] = 'monospace'

        if not is_contest_basicadmin(request):
            del self.fields['pub_date']
        else:
            self.fields['pub_date'].widget = DateTimePicker()
            self.fields['pub_date'].initial = timezone.now()
            # DateTimePicker is always narrow,
            # we don't mark it manually

        self.request = request

        instance = kwargs.get('instance', None)
        if instance is not None:
            self.fields['category'].choices = get_categories(request)
            self.fields['category'].initial = get_category(instance)
        else:
            self.fields['category'].choices = [('', '')] + get_categories(request)
Example #4
0
    def __init__(self, request, *args, **kwargs):
        super(AddContestMessageForm, self).__init__(*args, **kwargs)
        self.fields['topic'].widget.attrs['class'] = 'input-xxlarge'
        self.fields['content'].widget.attrs['class'] = \
                'input-xxlarge monospace'

        if not is_contest_admin(request):
            del self.fields['pub_date']
        else:
            self.fields['pub_date'].widget = DateTimePicker()
            self.fields['pub_date'].initial = timezone.now()

        self.request = request

        instance = kwargs.get('instance', None)
        if instance is not None:
            self.fields['category'].choices = get_categories(request)
            self.fields['category'].initial = get_category(instance)
        else:
            self.fields['category'].choices = \
                    [('', '')] + get_categories(request)
Example #5
0
    def __init__(self, request, *args, **kwargs):
        super(AddContestMessageForm, self).__init__(*args, **kwargs)
        self.fields['topic'].widget.attrs['class'] = 'input-xxlarge'
        self.fields['content'].widget.attrs['class'] = \
                'input-xxlarge monospace'

        if not is_contest_admin(request):
            del self.fields['pub_date']
        else:
            self.fields['pub_date'].widget = DateTimePicker()
            self.fields['pub_date'].initial = timezone.now()

        self.request = request

        instance = kwargs.get('instance', None)
        if instance is not None:
            self.fields['category'].choices = get_categories(request)
            self.fields['category'].initial = get_category(instance)
        else:
            self.fields['category'].choices = \
                    [('', '')] + get_categories(request)