Changeset - 61cf00442673
[Not reviewed]
0 1 0
Brett Smith - 4 years ago 2018-10-12 01:17:17
proposals.forms: Link to one consistent Markdown cheat sheet.

I like this one best because it's most brief, visual, and clearly under a
free license (CC BY-SA 4.0).
1 file changed with 19 insertions and 10 deletions:
0 comments (0 inline, 0 general)
Show inline comments
from django import forms
from symposion.proposals.forms import ProposalMixIn

from .models import ConferenceSpeaker, TalkProposal


class ConferenceSpeakerForm(forms.ModelForm):

    class Meta:
        model = ConferenceSpeaker
        exclude = [
            # Not happening for CopyleftConf 2019.

    def __init__(self, *a, **k):
        super(ConferenceSpeakerForm, self).__init__(*a, **k)
        self.fields['code_of_conduct'].required = True
        for field in ('biography', 'experience'):
            self.fields[field].help_text = self.fields[field].help_text.replace(
                # Fix a typo in Symposion model help text:
                # <>
                "{}' target=".format(_MARKDOWN_CHEATSHEET_URL),



class ProposalForm(forms.ModelForm, ProposalMixIn):

    def __init__(self, *a, **k):
        super(ProposalForm, self).__init__(*a, **k)
        self.fields["additional_notes"].help_text = ("Anything else "
            "you'd like the program committee to know when making their "
            "selection. This is not made public. "
            "Edit using "
            "<a href='' "
        self.fields["abstract"].help_text = ("Detailed abstract. Will "
            "be made public if your proposal is accepted. Edit "
            "using <a href='' "
        self.fields["additional_notes"].help_text = """
Anything else you'd like the program committee to know when making their
selection. This is not made public. Edit using
<a href='{}' target='_blank'>Markdown</a>.""".format(_MARKDOWN_CHEATSHEET_URL)
        self.fields["abstract"].help_text = """
Detailed abstract. Will be made public if your proposal is accepted.
Edit using
<a href='{}' target='_blank'>Markdown</a>.""".format(_MARKDOWN_CHEATSHEET_URL)

        for field in ("description", "abstract", "additional_notes"):
            self.fields[field].help_text += (" Please do not include "
                "any information that could identify you, as your proposal "
                "will be reviewed anonymously.")


    def clean_description(self):
        value = self.cleaned_data["description"]
        if len(value) > 400:
            raise forms.ValidationError(
                u"The description must be less than 400 characters"
0 comments (0 inline, 0 general)