Exemplo n.º 1
0
 def save_model(self, request, obj, form, change):
     if not change:
         obj.owner = request.user
         obj.type = 'D' if request.REQUEST.get('type') == 'folder' else 'F'
         obj.icode = str_crc32('-'.join([obj.name, str(time.time())]))
     if obj.type == 'F':
         obj.name = os.path.basename(obj.file.name)
     obj.save()
Exemplo n.º 2
0
def doc_upload_to(instance, filename):
    return '/'.join([str(instance.owner_id),
                     timezone.now().strftime('%Y%m%d'),
                     str_crc32(filename) + os.path.splitext(filename)[1]])