How to use the pretalx.common.phrases.phrases.base function in pretalx

To help you get started, we’ve selected a few pretalx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pretalx / pretalx / src / pretalx / orga / forms / review.py View on Github external
choices=choices,
            required=event.settings.review_score_mandatory,
            widget=forms.RadioSelect,
            disabled=kwargs.get("read_only", False),
            help_text=ngettext_lazy(
                "You have {count} override vote left.",
                "You have {count} override votes left.",
                remaining_votes,
            ).format(count=remaining_votes)
            if remaining_votes
            else "",
        )
        self.fields["text"].widget.attrs["rows"] = 2
        self.fields["text"].widget.attrs["placeholder"] = phrases.orga.example_review
        self.fields["text"].required = event.settings.review_text_mandatory
        self.fields["text"].help_text += " " + phrases.base.use_markdown
github pretalx / pretalx / src / pretalx / submission / models / cfp.py View on Github external
class CfP(LogMixin, models.Model):
    """Every :class:`~pretalx.event.models.event.Event` has one Call for
    P(apers|articipation|roposals).

    :param deadline: The regular deadline. Please note that submissions can be available for longer than this if different deadlines are configured on single submission types.
    """

    event = models.OneToOneField(to="event.Event", on_delete=models.PROTECT)
    headline = I18nCharField(
        max_length=300, null=True, blank=True, verbose_name=_("headline")
    )
    text = I18nTextField(
        null=True,
        blank=True,
        verbose_name=_("text"),
        help_text=phrases.base.use_markdown,
    )
    default_type = models.ForeignKey(
        to="submission.SubmissionType",
        on_delete=models.PROTECT,
        related_name="+",
        verbose_name=_("Default submission type"),
    )
    deadline = models.DateTimeField(
        null=True,
        blank=True,
        verbose_name=_("deadline"),
        help_text=_(
            "Please put in the last date you want to accept submissions from users."
        ),
    )
github pretalx / pretalx / src / pretalx / cfp / views / user.py View on Github external
def form_valid(self, form):
        if self.can_edit:
            form.save()
            self.qform.save()
            result = self.save_formset(form.instance)
            if not result:
                return self.get(self.request, *self.args, **self.kwargs)
            if form.has_changed():
                if form.instance.pk and "duration" in form.changed_data:
                    form.instance.update_duration()
                form.instance.log_action(
                    "pretalx.submission.update", person=self.request.user
                )
                self.request.event.cache.set("rebuild_schedule_export", True, None)
            messages.success(self.request, phrases.base.saved)
        else:
            messages.error(self.request, phrases.cfp.submission_uneditable)
        return redirect(self.object.urls.user_base)
github pretalx / pretalx / src / pretalx / submission / models / question.py View on Github external
related_name="questions",
        help_text=_(
            "You can limit this question to some tracks. Leave this field empty to apply to all tracks."
        ),
        verbose_name=_("Tracks"),
        blank=True,
    )
    question = I18nCharField(max_length=800, verbose_name=_("question"))
    help_text = I18nCharField(
        null=True,
        blank=True,
        max_length=200,
        verbose_name=_("help text"),
        help_text=_("Will appear just like this text below the question input field.")
        + " "
        + phrases.base.use_markdown,
    )
    default_answer = models.TextField(
        null=True, blank=True, verbose_name=_("default answer")
    )
    required = models.BooleanField(default=False, verbose_name=_("required"))
    position = models.IntegerField(default=0, verbose_name=_("position"))
    active = models.BooleanField(
        default=True,
        verbose_name=_("active"),
        help_text=_("Inactive questions will no longer be asked."),
    )
    contains_personal_data = models.BooleanField(
        default=True,
        verbose_name=_("Answers contain personal data"),
        help_text=_(
            "If a user deletes their account, answers of questions for personal data will be removed, too."
github pretalx / pretalx / src / pretalx / common / views.py View on Github external
def form_valid(self, form):
        user = form.cleaned_data["user"]

        if not user or (
            user.pw_reset_time
            and (now() - user.pw_reset_time).total_seconds() < 3600 * 24
        ):
            messages.success(self.request, phrases.cfp.auth_password_reset)
            return redirect(self.get_success_url())

        try:
            user.reset_password(event=getattr(self.request, "event", None))
        except SendMailException:
            messages.error(self.request, phrases.base.error_sending_mail)
            return self.get(self.request, *self.args, **self.kwargs)

        messages.success(self.request, phrases.cfp.auth_password_reset)
        user.log_action("pretalx.user.password.reset")

        return redirect(self.get_success_url())
github pretalx / pretalx / src / pretalx / person / forms.py View on Github external
from pretalx.cfp.forms.cfp import CfPFormMixin
from pretalx.common.forms.fields import (
    IMAGE_EXTENSIONS,
    PasswordConfirmationField,
    PasswordField,
)
from pretalx.common.forms.widgets import MarkdownWidget
from pretalx.common.mixins.forms import PublicContent, ReadOnlyFlag
from pretalx.common.phrases import phrases
from pretalx.person.models import SpeakerInformation, SpeakerProfile, User
from pretalx.schedule.forms import AvailabilitiesFormMixin


class UserForm(CfPFormMixin, forms.Form):
    login_email = forms.EmailField(
        max_length=60, label=phrases.base.enter_email, required=False
    )
    login_password = forms.CharField(
        widget=forms.PasswordInput, label=_("Password"), required=False
    )
    register_name = forms.CharField(label=_("Name"), required=False)
    register_email = forms.EmailField(label=_("Email address"), required=False)
    register_password = PasswordField(label=_("Password"), required=False)
    register_password_repeat = PasswordConfirmationField(
        label=_("Password (again)"), required=False, confirm_with="register_password"
    )

    def __init__(self, *args, **kwargs):
        kwargs.pop("event", None)
        super().__init__(*args, **kwargs)
        self.fields["register_email"].widget.attrs = {"placeholder": _("Email address")}
github pretalx / pretalx / src / pretalx / submission / models / feedback.py View on Github external
to="submission.Submission",
        related_name="feedback",
        on_delete=models.PROTECT,
        verbose_name=_("Talk"),
    )
    speaker = models.ForeignKey(
        to="person.User",
        related_name="feedback",
        null=True,
        blank=True,
        on_delete=models.PROTECT,
        verbose_name=_("Speaker"),
    )
    rating = models.IntegerField(null=True, blank=True, verbose_name=_("Rating"))
    review = models.TextField(
        verbose_name=_("Review"), help_text=phrases.base.use_markdown
    )

    objects = ScopedManager(event="talk__event")

    def __str__(self):
        """Help when debugging."""
        return f"Feedback(event={self.talk.event.slug}, talk={self.talk.title}, rating={self.rating})"
github pretalx / pretalx / src / pretalx / cfp / forms / auth.py View on Github external
def clean(self):
        data = super().clean()
        if data.get("password") != data.get("password_repeat"):
            self.add_error(
                "password_repeat", ValidationError(phrases.base.passwords_differ)
            )
        return data
github pretalx / pretalx / src / pretalx / orga / forms / event.py View on Github external
class ReviewSettingsForm(ReadOnlyFlag, I18nFormMixin, HierarkeyForm):
    review_score_mandatory = forms.BooleanField(
        label=_("Require a review score"), required=False
    )
    review_text_mandatory = forms.BooleanField(
        label=_("Require a review text"), required=False
    )
    review_help_text = I18nFormField(
        label=_("Help text for reviewers"),
        help_text=_(
            "This text will be shown at the top of every review, as long as reviews can be created or edited."
        )
        + " "
        + phrases.base.use_markdown,
        widget=I18nTextarea,
        required=False,
    )
    allow_override_votes = forms.BooleanField(
        label=_("Allow override votes"),
        help_text=_(
            'Review teams can be assigned a fixed amount of "override votes": Positive or negative vetos each reviewer can assign.'
        ),
        required=False,
    )
    review_min_score = forms.IntegerField(
        label=_("Minimum score"), help_text=_("The minimum score reviewers can assign")
    )
    review_max_score = forms.IntegerField(
        label=_("Maximum score"), help_text=_("The maximum score reviewers can assign")
    )
github pretalx / pretalx / src / pretalx / common / mixins / forms.py View on Github external
def get_field(self, *, question, initial, initial_object, readonly):
        from pretalx.submission.models import QuestionVariant

        original_help_text = question.help_text
        help_text = rich_text(question.help_text)
        if question.is_public:
            help_text += " " + str(phrases.base.public_content)
        count_chars = self.event.settings.cfp_count_length_in == "chars"
        if question.variant == QuestionVariant.BOOLEAN:
            # For some reason, django-bootstrap4 does not set the required attribute
            # itself.
            widget = (
                forms.CheckboxInput(attrs={"required": "required", "placeholder": ""})
                if question.required
                else forms.CheckboxInput()
            )

            field = forms.BooleanField(
                disabled=readonly,
                help_text=help_text,
                label=question.question,
                required=question.required,
                widget=widget,