Пример #1
0
 def resolve_speakers(self, info, **kwargs):
     organizer_id = get_organizer(info)
     id = kwargs.get('id')
     if id:
         return Speaker.objects.filter(organizer_id=organizer_id, id=id)
     else:
         return Speaker.objects.filter(organizer_id=organizer_id)
Пример #2
0
 def resolve_albums(self, info, **kwargs):
     organizer_id = get_organizer(info)
     id = kwargs.get('id')
     if id:
         return Album.objects.filter(
             id=kwargs.get('id'), organizer_id=organizer_id).order_by('-id')
     else:
         return Album.objects.filter(
             organizer_id=organizer_id).order_by('-id')
Пример #3
0
 def resolve_talks(self, info, **kwargs):
     organizer_id = get_organizer(info)
     id = kwargs.get('id')
     if id:
         return Talk.objects.filter(
             id=kwargs.get('id'),
             section__session__day__event__organizer_id=organizer_id)
     else:
         return Talk.objects.filter(
             section__session__day__event__organizer_id=organizer_id)
Пример #4
0
    def resolve_sponsors(self, info, **kwargs):
        event_id = kwargs.get('event', None)
        organizer_id = get_organizer(info)
        id = kwargs.get('id', None)

        if id:
            return Sponsors.objects.get(pk=id)
        if event_id:
            return Sponsors.objects.filter(event__id=event_id)

        return Sponsors.objects.filter(organizer__id=organizer_id)
Пример #5
0
    def resolve_talks_with_event(self, info, **kwargs):
        organizer_id = get_organizer(info)
        result = []
        events = Event.objects.filter(
            organizer_id=organizer_id).order_by('-start_date')

        for item in events:
            a = TalksWithEventSchemaType()
            a.event = item
            result.append(a)

        return result
Пример #6
0
 def resolve_featured_talk(self, info, **kwargs):
     organizer_id = get_organizer(info)
     items = Talk.objects.filter(
         section__session__day__event__organizer_id=organizer_id)
     return random.choice(items)
Пример #7
0
    def resolve_talk(self, info, **kwargs):
        organizer_id = get_organizer(info)

        return Talk.objects.get(
            id=kwargs.get('id'),
            section__session__day__event__organizer_id=organizer_id)
Пример #8
0
    def resolve_speaker(self, info, **kwargs):
        organizer_id = get_organizer(info)

        return Speaker.objects.get(id=kwargs.get('id'),
                                   organizer_id=organizer_id)
Пример #9
0
    def resolve_album(self, info, **kwargs):
        organizer_id = get_organizer(info)

        return Album.objects.get(id=kwargs.get('id'),
                                 organizer_id=organizer_id)
Пример #10
0
 def resolve_organizer(self, info, **kwargs):
     organizer_id = get_organizer(info)
     return Organizer.objects.get(id=organizer_id)