Esempio n. 1
0
    def __call__(self):
        data = tablib.Dataset(headers=['Session ID (Optional)',
            'Session Name (Optional)', 'Link To Session ID (Optional)',
            'Link To Session Name (Optional)', 'Link To Item ID (Optional)',
            'Link To Item Name (Optional)', 'Link To Form Name (Optional)'])
        sessions = models.Session.objects \
            .select_related('kind', 'speaker__user__profile') \
            .prefetch_related('additional_speakers__user__profile') \
            .filter(released=True, start__isnull=False, end__isnull=False) \
            .exclude(kind__slug__in=('poster')) \
            .only('title',
                  'kind__slug',
                  'speaker__user__username',
                  'speaker__user__profile__avatar',
                  'speaker__user__profile__full_name',
                  'speaker__user__profile__display_name',
                  'speaker__user__profile__user') \
            .all()

        for session in sessions:
            user = session.speaker.user
            speakers = set([get_full_name(user)])
            for speaker in session.additional_speakers.all():
                speakers.add(get_full_name(user))
            form = 'Talk Feedback' if session.kind.slug in ('talk', 'keynote', 'sponsored') else ''
            data.append([
                '',
                session.title,
                '',
                '',
                '',
                ';'.join(speakers),
                form
                ])
        return data
Esempio n. 2
0
    def __call__(self):
        data = tablib.Dataset(headers=['Name',
            'Sub-Title (i.e. Location, Table/Booth, or Title/Sponsorship Level)',
            'Description (Optional)', 'Location/Room'])
        speakers = set()
        sessions = models.Session.objects \
            .select_related('speaker__user__profile') \
            .prefetch_related('additional_speakers__user__profile') \
            .filter(released=True, start__isnull=False, end__isnull=False) \
            .exclude(kind__slug__in=('poster')) \
            .only('speaker__user__username',
                  'speaker__user__profile__avatar',
                  'speaker__user__profile__full_name',
                  'speaker__user__profile__display_name',
                  'speaker__user__profile__short_info',
                  'speaker__user__profile__user') \
            .all()
        for session in sessions:
            user = session.speaker.user
            speakers.add((get_full_name(user), user.profile.short_info_rendered))
            for speaker in session.additional_speakers.all():
                user = speaker.user
                speakers.add((get_full_name(user), user.profile.short_info_rendered))

        speakers = sorted(speakers)
        for speaker in speakers:
            data.append([
                speaker[0],
                '',
                speaker[1].encode('utf-8'),
                ''
                ])
        return data
Esempio n. 3
0
 def _export_session(self, xf, session):
     with xf.element('vevent'):
         with xf.element('method'):
             xf.write('PUBLISH')
         with xf.element('uid'):
             xf.write('%d@%s@%s' % (session.id, self.conference, self.domain))
         with xf.element('{http://pentabarf.org}event-id'):
             xf.write(force_text(session.id))
         with xf.element('{http://pentabarf.org}event-slug'):
             xf.write(slugify(session.title))
         with xf.element('{http://pentabarf.org}title'):
             xf.write(session.title)
         with xf.element('{http://pentabarf.org}subtitle'):
             xf.write('')
         with xf.element('{http://pentabarf.org}language'):
             xf.write(session.get_language_display())
         with xf.element('{http://pentabarf.org}language-code'):
             xf.write(session.language)
         with xf.element('dtstart'):
             xf.write(session.start.strftime('%Y%m%dT%H%M%S'))
         with xf.element('dtend'):
             xf.write(session.end.strftime('%Y%m%dT%H%M%S'))
         with xf.element('duration'):
             duration = self._duration_base + (session.end - session.start)
             xf.write(duration.strftime('%HH%MM%SS'))
         with xf.element('summary'):
             xf.write(session.title)
         with xf.element('description'):
             xf.write(session.abstract_rendered)
         with xf.element('class'):
             xf.write('PUBLIC')
         with xf.element('status'):
             xf.write('CONFIRMED')
         with xf.element('category'):
             xf.write(force_text(session.kind))
         with xf.element('url'):
             xf.write(session.get_absolute_url())
         for location in session.location.all():
             with xf.element('location'):
                 xf.write(force_text(location))
         with xf.element('attendee'):
             xf.write(get_full_name(session.speaker.user))
         for cospeaker in session.additional_speakers.all():
             with xf.element('attendee'):
                 xf.write(get_full_name(session.speaker.user))
Esempio n. 4
0
 def _export_speaker(self, fp, xf, user):
     profile = user.profile
     with xf.element('speaker', id=force_text(user.id)):
         with xf.element('name'):
             name = get_full_name(user)
             xf.write(name, pretty_print=self.pretty)
         with xf.element('profile'):
             xf.write(self.base_url + reverse('account_profile',
                                              kwargs={'uid': user.id}), pretty_print=self.pretty)
         with xf.element('description'):
             xf.write(user.profile.short_info, pretty_print=self.pretty)
         with xf.element('image'):
             if profile.avatar:
                 avatar_url = self.base_url + profile.avatar.url
                 xf.write(avatar_url, pretty_print=self.pretty)
             if self.export_avatars:
                 filename, ext = os.path.splitext(profile.avatar.file.name)
                 dest = os.path.join(self.avatar_dir, str(user.id)) + ext
                 shutil.copy(profile.avatar.file.name, dest)
Esempio n. 5
0
 def __unicode__(self):
     return account_utils.get_full_name(self.user)
Esempio n. 6
0
 def __unicode__(self):
     return account_utils.get_full_name(self.user)