How to use the pretalx.event.models.Event 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 / common / management / commands / create_test_event.py View on Github external
)
        if end_stage == "cfp":
            event_start = now() + dt.timedelta(days=35)
        elif end_stage == "review":
            event_start = now() + dt.timedelta(days=25)
        elif end_stage == "over":
            event_start = now() - dt.timedelta(days=10)
        else:  # end_stage == 'schedule'
            event_start = now() - dt.timedelta(days=1)
        self.bs = self.fake.bs()
        self.catch_phrase = self.fake.catch_phrase()
        intro = f"We provide a {self.catch_phrase.lower()} to {self.bs}."
        disclaimer = """This is an automatically generated event to test and showcase pretalx features.
Feel free to look around, but don\'t be alarmed if something doesn\'t quite make sense. You can always create your own free test event at [pretalx.com](https://pretalx.com)!"""
        with scopes_disabled():
            event = Event.objects.create(
                name="DemoCon",
                slug="democon",
                organiser=organiser,
                is_public=True,
                date_from=event_start.date(),
                date_to=event_start.date() + dt.timedelta(days=2),
                timezone="Europe/Berlin",
                email=self.fake.user_name() + "@example.org",
                primary_color=self.fake.hex_color(),
                locale_array="en",
                locale="en",
                landing_page_text=f"# Welcome to DemoCon!\n\n{intro}\n\n{disclaimer}",
            )
        with scope(event=event):
            event.build_initial_data()
            team.limit_events.add(event)
github pretalx / pretalx / src / pretalx / orga / authorization.py View on Github external
def dispatch(self, request, *args, **kwargs):
        if request.user.is_anonymous:
            return redirect(self.login_url)

        event_slug = kwargs.get('event')
        if event_slug:
            try:
                request.event = Event.objects.get(slug=event_slug)
            except Event.DoesNotExist:
                raise PermissionDenied()

            is_permitted = EventPermission.objects.filter(
                user=request.user,
                event=request.event,
                is_orga=True,
            ).exists()

            if not is_permitted:
                raise PermissionDenied()

        return super().dispatch(request, *args, **kwargs)
github pretalx / pretalx / src / pretalx / orga / views / event.py View on Github external
def done(self, form_list, *args, **kwargs):
        steps = {
            step: self.get_cleaned_data_for_step(step)
            for step in ("initial", "basics", "timeline", "display", "copy")
        }

        with scopes_disabled():
            event = Event.objects.create(
                organiser=steps["initial"]["organiser"],
                locale_array=",".join(steps["initial"]["locales"]),
                name=steps["basics"]["name"],
                slug=steps["basics"]["slug"],
                timezone=steps["basics"]["timezone"],
                email=steps["basics"]["email"],
                locale=steps["basics"]["locale"],
                primary_color=steps["display"]["primary_color"],
                logo=steps["display"]["logo"],
                date_from=steps["timeline"]["date_from"],
                date_to=steps["timeline"]["date_to"],
            )
        with scope(event=event):
            deadline = steps["timeline"].get("deadline")
            if deadline:
                zone = timezone(event.timezone)
github pretalx / pretalx / src / pretalx / event / services.py View on Github external
def task_periodic_event_services(event_slug):
    with scopes_disabled():
        event = (
            Event.objects.filter(slug=event_slug)
            .prefetch_related("_settings_objects", "submissions__slots")
            .first()
        )
    if not event:
        return

    _now = now()
    with scope(event=event):
        event.build_initial_data()  # Make sure the required mail templates are there
        if not event.settings.sent_mail_event_created:
            if (
                dt.timedelta(0)
                <= (_now - event.log_entries.last().timestamp)
                <= dt.timedelta(days=1)
            ):
                event.send_orga_mail(event.settings.mail_text_event_created)
github pretalx / pretalx / src / pretalx / orga / management / commands / import_schedule.py View on Github external
def handle(self, *args, **options):
        from pretalx.schedule.utils import process_frab

        path = options.get("path")
        tree = ET.parse(path)
        root = tree.getroot()

        event_data = root.find("conference")
        event = Event.objects.filter(
            slug__iexact=event_data.find("acronym").text
        ).first()

        with scopes_disabled():
            if not event:
                event = self.create_event(event_data)
            team = event.organiser.teams.filter(
                can_create_events=True,
                can_change_teams=True,
                can_change_organiser_settings=True,
                can_change_event_settings=True,
                can_change_submissions=True,
            ).first()
            if not team:
                team = Team.objects.create(
                    name=str(event.name) + " Organisers",