Beispiel #1
0
    def post(self):
        contests = Contest.all().order('-created')
        today = datetime.datetime.now()
        c = self.request.get('c')
        
        if c:
            upload_url = blobstore.create_upload_url('/administration/contest?c='+c)
            try:
                ct = Contest.get(c)
                form = ContestForm(self.request.POST, instance=ct)
            except:
                form = ContestForm(self.request.POST)
        else:
            upload_url = blobstore.create_upload_url('/administration/contest')
            form = ContestForm(self.request.POST)

        if form.is_valid():
            contest = form.save(commit=False)
            upload_files = self.get_uploads('file')
            if upload_files:
                contest.banner = upload_files[0]
            contest.put()

            self.redirect(self.uri_for('admin_contest')+'?success=1')

        return self.render_response(self.template, locals())
Beispiel #2
0
    def get(self):
        page = 'contest'
        tab = self.request.get('tab', 'kontes')

        active_contest = Contest.active_contest()

        contests = Contest.all().order('-created')
        return self.render_response(self.template, locals())
Beispiel #3
0
    def get(self):
        contests = Contest.all().order('-created')
        querystring = self.request.GET
        today = datetime.datetime.now()

        c = self.request.get('c')
        if c:
            upload_url = blobstore.create_upload_url('/administration/contest?c='+c)
            try:
                ct = Contest.get(c)

                # Interrupt form when delete action available
                if self.request.get('action') == 'delete':
                    ct.delete()
                    self.redirect(self.uri_for('admin_contest')+'?success=2')

                form = ContestForm(instance=ct)
            except:
                form = ContestForm()
        else:
            upload_url = blobstore.create_upload_url('/administration/contest')
            form = ContestForm()

        return self.render_response(self.template, locals())