Exemplo n.º 1
0
 def setUp(self):
     self.design = Design(css_product='product.css', css_home='qshops-home.css', home_template='qshops-home.html', product_template='product.html')
     self.design.put()
     namespace_manager.set_namespace('b')
     self.shop = Shop().all().get()
     self.shop.design = self.design
     self.shop.put()
Exemplo n.º 2
0
class TestStyles(unittest.TestCase):

    def setUp(self):
        self.design = Design(css_product='product.css', css_home='qshops-home.css', home_template='qshops-home.html', product_template='product.html')
        self.design.put()
        namespace_manager.set_namespace('b')
        self.shop = Shop().all().get()
        self.shop.design = self.design
        self.shop.put()
        
    def test_reserved(self):
       namespace_manager.set_namespace('b')
       self.assertTrue(True, 'Not reserving correctly') 
                
        
        
        
        
Exemplo n.º 3
0
 def get(self, subdomain):
     namespace_manager.set_namespace(subdomain)
     shop = Shop.all().get()
     designs = Design.all()
     context = {
                'url':webapp2.uri_for('addproducts'),
                'designs':designs,
                'shop':shop,
                }
     self.render_response('admin-products.html',**context)
Exemplo n.º 4
0
def createDesign(request):
    if request.method == 'POST':

        objs = json.loads(request.body)

        designer = Designer()
        designer.name = objs['designer_name']
        designer.lastname = objs['designer_last_name']
        designer.email = objs['designer_email']
        designer.save()

        design = Design()

        design.price = objs['price']
        design.status = 1

        base64_string = objs['imageFile'].encode('utf-8')
        print objs['imageFile']
        print base64_string

        filename = str(time.time())+".png"

        # decoding base string to image and saving in to your media root folder
        fh = open(os.path.join(PROJECT_ROOT+'/static/images', filename), "wb")
        fh.write(bytes(base64_string.decode('base64')))
        fh.close()

        # saving decoded image to database
        decoded_image = base64_string.decode('base64')
        design.imageFile = ContentFile(decoded_image, filename)

        projectQS = Proyecto.objects.filter(pk=int(objs['project_pk']))
        projectsList = list(projectQS[:1])
        projectObject = projectsList[0]

        design.project = projectObject
        design.designer = designer

        design.save()

    return JsonResponse({})