Ejemplo n.º 1
0
class ProductBaseForm(Bootstrap3HorizontalFormHelperMixin, ModelForm):
    form_tag = False

    description = MarkdownField(label=_('Description'))
    project = forms.ModelChoiceField(
        queryset=Project.objects.filter(status='done'),
        label=_('Project'),
        required=False)
    platforms = forms.ModelMultipleChoiceField(
        label=_('Platforms'),
        widget=widgets.CheckboxSelectMultiple,
        queryset=Platform.objects.all().order_by('pk'))
    categories = forms.ModelMultipleChoiceField(
        label=_('Categories'),
        widget=widgets.CheckboxSelectMultiple,
        queryset=Category.objects.all().order_by('pk'))
    administrators = PersonaChoiceField(
        label=_('Administrators'),
        queryset=Persona.objects.filter(is_active=True).order_by('pk'),
        help_text=_('Add administrator users of this product'))
    published_at = forms.DateField(
        label=_('Published at'),
        widget=forms.DateInput(attrs={'type': 'date'}))

    class Meta:
        model = Product
        exclude = ()

    def get_additional_objects(self):
        # Saveボタンを描画しない
        return []
Ejemplo n.º 2
0
class KawazCommentForm(CommentForm):
    name = forms.CharField(required=False)
    email = forms.EmailField(required=False)
    comment = MarkdownField()

    def __init__(self, *args, **kwargs):
        super(KawazCommentForm, self).__init__(*args, **kwargs)
Ejemplo n.º 3
0
class AnnouncementForm(Bootstrap3HorizontalFormHelperMixin, ModelForm):

    body = MarkdownField(label=_('Body'))

    class Meta:
        model = Announcement
        exclude = (
            'author',
            'created_at',
            'updated_at',
        )
Ejemplo n.º 4
0
class ProjectCreateForm(Bootstrap3HorizontalFormHelperMixin, ModelForm):

    body = MarkdownField(label=_('body'))

    class Meta:
        model = Project
        exclude = (
            'administrator',
            'members',
            'created_at',
            'updated_at',
        )
Ejemplo n.º 5
0
class EntryForm(Bootstrap3HorizontalFormHelperMixin, ModelForm):

    body = MarkdownField(label=_('Body'))
    category = CategoryChoiceField(label=_('Category'), queryset=Category.objects.all(), required=False)

    def __init__(self, *args, **kwargs):
        user = kwargs.pop('user', None)
        super().__init__(*args, **kwargs)
        self.fields['category'].queryset = Category.objects.filter(author=user)

    class Meta:
        model = Entry
        exclude = (
            'author',
            'created_at',
            'updated_at',
            'published_at',
        )
Ejemplo n.º 6
0
class EventForm(Bootstrap3HorizontalFormHelperMixin, ModelForm):
    body = MarkdownField(label=_('Body'))
    period_start = forms.DateTimeField(
        label=_('Start time'),
        widget=forms.DateTimeInput(attrs={'type': 'datetime'}),
        required=False)
    period_end = forms.DateTimeField(
        label=_('End time'),
        widget=forms.DateTimeInput(attrs={'type': 'datetime'}),
        required=False)
    attendance_deadline = forms.DateTimeField(
        label=_('Attendance deadline'),
        widget=forms.DateTimeInput(attrs={'type': 'datetime'}),
        required=False,
        help_text=ATTENDANCE_DEADLINE_HELP_TEXT)

    class Meta:
        model = Event
        exclude = (
            'organizer',
            'created_at',
            'updated_at',
        )
Ejemplo n.º 7
0
class KawazCommentForm(CommentForm):
    comment = MarkdownField()

    def __init__(self, *args, **kwargs):
        super(KawazCommentForm, self).__init__(*args, **kwargs)