Exemple #1
0
        def post(self, **kwargs):
            image = self.request.files.get('image_upload').read()
            datestring = self.request.form.get('start-date')
            start_date = self.castTime(datestring)
            #end_date = self.castTime(self.request.form.get('finish-date'), self.request.form.get('finish-time'))
            #start_date = datetime.datetime(self.request.form.get('start_time'))
            
            params = {
                        "file": images.resize(image, 90, 90),
                        "file150": images.resize(image, 150, 150),
                        "filetype": self.request.files.get('image_upload').filename,
                        "name" : self.request.form.get('name'),
                        "start_date" : start_date,
#                        "end_date" : end_date,
                        "description" : self.request.form.get('description'),
                        "creator" : self.auth.user,
                        "people_invited" : self.request.form.getlist('contacts[]'),
#                        "type" : self.request.form.get('type'),
                        "setlist" : self.request.form.getlist('songs[]')
                    
                  }
            manager = EventDelegate('Event')
            value = manager.add(params)
            songs = Song.all()
            
            return self.redirect('/dashboard')
Exemple #2
0
 def get(self,key):
     response = Response()
     response.headers['Content-Type'] = "image"
     response.headers['Content-Disposition'] = "attachment"
     try:
         manager = EventDelegate('Event')
         result = manager.getFile(key.split('.')[0],150)
     except Exception,e:
         result = self.wrapFault(e.message)
Exemple #3
0
 def get(self, **kwargs):
     network = pylast.LastFMNetwork(api_key = API_KEY, api_secret = API_SECRET)
     
     manager = EventDelegate('Event')
     events = manager.listEvents(self.auth.user)
     popular_songs = []
     count_events = events.count()
     for e in events:
         for s in e.event_setlist:
             aux = True
             if len(popular_songs) > 0 :
                 for p in popular_songs:
                     if p[0] == s.song.name:
                         p[1] = int(p[1])+int(s.votes)
                         aux = False
                 if aux:
                     popular_songs.append([s.song.name,s.votes,network.get_artist(s.song.artist.name)])
             else:
                 popular_songs.append([s.song.name,s.votes,network.get_artist(s.song.artist.name)])
                 
     ps = sorted(popular_songs, key=lambda song: song[1], reverse=True)[:5]
     
         
     return self.render_response('dashboard.html',section='dashboard', events=events,popular_songs=ps,count_events=count_events)
Exemple #4
0
 def get(self, **kwargs):
     
     manager = EventDelegate('Event')
     events = manager.listEvents(self.auth.user)
     
     return self.render_response('create_event.html',events=events)