예제 #1
0
파일: exporters.py 프로젝트: vmx/pretalx
 def render(self, **kwargs):
     url = get_base_url(self.event)
     context = {
         'data': self.data,
         'url': url,
         'domain': urlparse(url).netloc
     }
     content = get_template('agenda/schedule.xcal').render(context=context)
     return f'{self.event.slug}.xcal', 'text/xml', content
예제 #2
0
 def render(self, **kwargs):
     url = get_base_url(self.event)
     context = {
         "data": self.data,
         "url": url,
         "domain": urlparse(url).netloc
     }
     content = get_template("agenda/schedule.xcal").render(context=context)
     return f"{self.event.slug}.xcal", "text/xml", content
예제 #3
0
 def render(self, **kwargs):
     context = {
         'data': self.data,
         'metadata': self.metadata,
         'schedule': self.schedule,
         'event': self.event,
         'version': __version__,
         'base_url': get_base_url(self.event),
     }
     content = get_template('agenda/schedule.xml').render(context=context)
     return f'{self.event.slug}-schedule.xml', 'text/xml', content
예제 #4
0
 def render(self, **kwargs):
     context = {
         "data": self.data,
         "metadata": self.metadata,
         "schedule": self.schedule,
         "event": self.event,
         "version": __version__,
         "base_url": get_base_url(self.event),
     }
     content = get_template("agenda/schedule.xml").render(context=context)
     return f"{self.event.slug}-schedule.xml", "text/xml", content
예제 #5
0
    def render(self, **kwargs):
        netloc = urlparse(get_base_url(self.event)).netloc
        cal = vobject.iCalendar()
        cal.add('prodid').value = '-//pretalx//{}//'.format(netloc)
        creation_time = datetime.now(pytz.utc)

        talks = (self.schedule.talks.filter(is_visible=True).prefetch_related(
            'submission__speakers').select_related('submission',
                                                   'room').order_by('start'))
        for talk in talks:
            talk.build_ical(cal, creation_time=creation_time, netloc=netloc)

        return f'{self.event.slug}.ics', 'text/calendar', cal.serialize()
예제 #6
0
    def render(self, **kwargs):
        netloc = urlparse(get_base_url(self.event)).netloc
        cal = vobject.iCalendar()
        cal.add("prodid").value = "-//pretalx//{}//".format(netloc)
        creation_time = dt.datetime.now(pytz.utc)

        talks = (self.schedule.talks.filter(is_visible=True).prefetch_related(
            "submission__speakers").select_related(
                "submission", "room", "submission__event").order_by("start"))
        for talk in talks:
            talk.build_ical(cal, creation_time=creation_time, netloc=netloc)

        return f"{self.event.slug}.ics", "text/calendar", cal.serialize()
예제 #7
0
    def get(self, request, event, **kwargs):
        schedule = self.get_object()
        netloc = urlparse(get_base_url(request.event)).netloc

        cal = vobject.iCalendar()
        cal.add('prodid').value = '-//pretalx//{}//'.format(netloc)
        creation_time = datetime.now(pytz.utc)

        talks = schedule.talks.filter(
            is_visible=True
        ).prefetch_related('submission__speakers').select_related('submission', 'room').order_by('start')
        for talk in talks:
            talk.build_ical(cal, creation_time=creation_time, netloc=netloc)

        resp = HttpResponse(cal.serialize(), content_type='text/calendar')
        resp['Content-Disposition'] = f'attachment; filename="{request.event.slug}.ics"'
        return resp
예제 #8
0
파일: slot.py 프로젝트: morisson/pretalx
    def build_ical(self, calendar, creation_time=None, netloc=None):
        creation_time = creation_time or datetime.now(pytz.utc)
        netloc = netloc or urlparse(get_base_url(self.event)).netloc
        tz = pytz.timezone(self.submission.event.timezone)

        vevent = calendar.add('vevent')
        vevent.add('summary').value = f'{self.submission.title} - {self.submission.display_speaker_names}'
        vevent.add('dtstamp').value = creation_time
        vevent.add('location').value = str(self.room.name)
        vevent.add('uid').value = 'pretalx-{}-{}@{}'.format(
            self.submission.event.slug, self.submission.code,
            netloc
        )

        vevent.add('dtstart').value = self.start.astimezone(tz)
        vevent.add('dtend').value = self.end.astimezone(tz)
        vevent.add('description').value = self.submission.abstract or ""
        vevent.add('url').value = self.submission.urls.public.full()
예제 #9
0
    def build_ical(self, calendar, creation_time=None, netloc=None):
        if not self.start or not self.end or not self.room:
            return
        creation_time = creation_time or dt.datetime.now(pytz.utc)
        netloc = netloc or urlparse(get_base_url(self.event)).netloc
        tz = pytz.timezone(self.submission.event.timezone)

        vevent = calendar.add("vevent")
        vevent.add(
            "summary"
        ).value = f"{self.submission.title} - {self.submission.display_speaker_names}"
        vevent.add("dtstamp").value = creation_time
        vevent.add("location").value = str(self.room.name)
        vevent.add("uid").value = "pretalx-{}-{}@{}".format(
            self.submission.event.slug, self.submission.code, netloc)

        vevent.add("dtstart").value = self.start.astimezone(tz)
        vevent.add("dtend").value = self.end.astimezone(tz)
        vevent.add("description").value = self.submission.abstract or ""
        vevent.add("url").value = self.submission.urls.public.full()
예제 #10
0
 def html_export_url(self) -> str:
     return get_base_url(self) + self.orga_urls.schedule_export_download
예제 #11
0
 def get_context_data(self, *args, **kwargs):
     ctx = super().get_context_data(*args, **kwargs)
     url = get_base_url(self.request.event)
     ctx['url'] = url
     ctx['domain'] = urlparse(url).netloc
     return ctx