Example #1
0
def store_create(request, parent_path):
    path = request.POST.get('path')
    if not path:
        raise PermissionDenied()
    a, b = parent_path.split('/')[:2]
    blog = get_object_or_404(Blog, id=int(a))
    if b not in ['galleries', 'files', 'listings']:
        raise PermissionDenied()
    if '/' in path:
        raise PermissionDenied()
    fullpath = '/'.join([parent_path, path]).replace('//', '/')
    new_store = Store(path=fullpath)
    new_store.save()
    blog.stores.add(new_store)
    blog.save()
    return redirect(reverse_lazy('profile') + "#tab4")
Example #2
0
def store_create(request, parent_path):
    path = request.POST.get('path')
    if not path:
        raise PermissionDenied()
    a,b = parent_path.split('/')[:2]
    blog = get_object_or_404(Blog, id=int(a))
    if b not in ['galleries', 'files', 'listings']:
        raise PermissionDenied()
    if '/' in path:
        raise PermissionDenied()
    fullpath = '/'.join([parent_path, path]).replace('//', '/')
    new_store = Store(path=fullpath)
    new_store.save()
    blog.stores.add(new_store)
    blog.save()
    return redirect(reverse_lazy('profile')+"#tab4")
Example #3
0
 def save(self, *args, **kwargs):
     r = super(Blog, self).save(*args, **kwargs)
     if not self.static:  # No static file store, add one
         path = "%s/%s" % (self.id, "files")
         store = Store(path=path)
         store.save()
         self.static = store
         r = super(Blog, self).save(*args, **kwargs)
     if not self.galleries:  # No static galleries store, add one
         path = "%s/%s" % (self.id, "galleries")
         store = Store(path=path)
         store.save()
         self.galleries = store
         r = super(Blog, self).save(*args, **kwargs)
     r = super(Blog, self).save(*args, **kwargs)
     blog_sync.delay(self.id)
     return r
Example #4
0
 def save(self, *args, **kwargs):
     r=super(Blog, self).save(*args, **kwargs)
     if not self.static:  # No static file store, add one
         path = "%s/%s" % (self.id, "files")
         store = Store(path=path)
         store.save()
         self.static = store
         r=super(Blog, self).save(*args, **kwargs)
     if not self.galleries:  # No static galleries store, add one
         path = "%s/%s" % (self.id, "galleries")
         store = Store(path=path)
         store.save()
         self.galleries = store
         r=super(Blog, self).save(*args, **kwargs)
     r=super(Blog, self).save(*args, **kwargs)
     blog_sync.delay(self.id)
     return r