Ejemplo n.º 1
0
    def post(self):
        project = PortfolioProject.get_by_id(long(self.request.params.get("project_id", None)))
        teaser = ImageRecord.get_by_id(long(self.request.params.get("teaser_id", None)))
        project.image = teaser
        project.save()

        self.response.headers['Content-Type'] = 'application/json'
        self.response.out.write(json.dumps({
            "teaser": images.get_serving_url(teaser.image.key(), 800, False)
            }))
Ejemplo n.º 2
0
    def get(self, project_id, extra=""):
        project = PortfolioProject.get_by_id(long(project_id))
        form = PortfolioProjectForm(obj = project)
        form.technologies.choices = [(tech.key().id(), tech.title) for tech in Technology.all().fetch(None)]

        return {
            "admin_section": "admin-projects-portfolio",
            "form": form,
            "success": extra == "saved",
            "upload_url": blobstore.create_upload_url(webapp2.uri_for('image-upload')),
            "project": project,
        }
Ejemplo n.º 3
0
    def post(self, project_id, extra=""):
        project = PortfolioProject.get_by_id(long(project_id))
        form = PortfolioProjectForm(self.request.POST)
        form.technologies.choices = [(tech.key().id(), tech.title) for tech in Technology.all().fetch(None)]
        success = False

        if form.validate():
            form.populate_obj(project)
            project.save()
            success = True

        return {
            "admin_section": "admin-projects-portfolio",
            "form": form,
            "success": success,
            "project": project,
        }
Ejemplo n.º 4
0
    def get(self, project_id):
        project = PortfolioProject.get_by_id(long(project_id))

        return {"section": "portfolio", "project": project}