Example #1
0
 def rawPost(self, ballotID, voteID):
     vote = self.getVote(ballotID, voteID)
     id = self.request.get('release.id', default_value=None)
     mbid = self.request.get('release.mbid', default_value=None)
     if id:
         vote.release = db.Key.from_path(Release.kind(), int(id))
     elif mbid:
         vote.release = Release.get(mbid)
     else:
         id = self.request.get('artist.id', default_value=None)
         mbid = self.request.get('artist.mbid', default_value=None)
         if id:
             artist = db.Key.from_path(Artist.kind(), int(id))
         elif mbid:
             artist = Artist.get(mbid)
         else:
             artist = Artist(name=self.request.get('artist'),
                             sortname=self.request.get('sortname'))
             artisturl = self.request.get('artisturl', default_value=None)
             if artisturl:
                 artist.url = artisturl
             artist.put()
         release = Release(artist=artist, title=self.request.get('title'))
         releaseurl = self.request.get('releaseurl', default_value=None)
         if releaseurl:
             release.url = releaseurl
         release.put()
         vote.release = release
     vote.put()
     next = Vote.gql('WHERE release = :1 ORDER BY artist', None).get()
     if next:
         key = next.key()
         self.redirect('../%d/%d' % (key.parent().id(), key.id()))
     else:
         self.redirect('../..')
Example #2
0
 def get(self, year):
     poll = Poll.get(year)
     if not poll:
         self.response.out.write('No poll for ' + year + '.')
         return
     unc = []
     for b in poll.ballots():
         unc.extend(Vote.gql('WHERE ballot = :1 AND release = :2', b, None))
     unc.sort(key=lambda v: v.artist.lower())
     self.render('admin.html', poll=poll, unc=unc)