Ejemplo n.º 1
0
def get_left_right_measure(value):
    val = str(value)
    if '_right_' in val:
        return txt(val.split('_right_')[-1])
    elif '_left_' in val:
        return txt(val.split('_left_')[-1])
    else:
        return txt(val.split('_right')[0].split('_left')[0])
Ejemplo n.º 2
0
def verbose_names(model):
    app_name = camelcase_to_underscore(model.__module__.split('.')[0])
    text = camelcase_to_underscore(model.__name__)
    for field in model._meta.fields:
        setattr(field, 'verbose_name', txt(field.name))
    for field in model._meta.many_to_many:
        setattr(field, 'verbose_name', txt(field.name))
    model._meta.app_label = StringWithTitle(app_name, txt(app_name))
    model._meta.verbose_name = txt(text)
    model._meta.verbose_name_plural = txt(text + 's')
    return model
Ejemplo n.º 3
0
def verbose_names(model):
    app_name = camelcase_to_underscore(model.__module__.split('.')[0])
    text = camelcase_to_underscore(model.__name__)
    for field in model._meta.fields:
        setattr(field, 'verbose_name', txt(field.name))
    for field in model._meta.many_to_many:
        setattr(field, 'verbose_name', txt(field.name))
    model._meta.app_label = StringWithTitle(app_name, txt(app_name))
    model._meta.verbose_name = txt(text)
    model._meta.verbose_name_plural = txt(text + 's')
    return model
Ejemplo n.º 4
0
def sample_index(request, context={}, status=None):
    logger.debug('sample_index <-')
    
    q = Sample.objects.all().order_by('name')

    if status:
        q = q.filter(status=status)

    # Make sure page request is an int. If not, deliver first page.
    try:
        pagenum = int(request.GET.get('page', '1'))
    except ValueError:
        pagenum = 1
    logger.debug('pagenum : %d' % pagenum)

    context["title"] = txt('Samples')
    context['result_headers'] = [
                                 {'text'  : txt('name'), },
                                 {'text'  : txt('status'), },
                                 {'text'  : txt('edit'), },
                                 {'text'  : txt('delete'), },
                                 ]
    return object_list(request, q, page=pagenum, paginate_by=10, template_name='blueprint/sample_list.html', extra_context=context)
Ejemplo n.º 5
0
def sample_create(request):
    if request.method == 'POST':
        key = request.POST['key']
        name = request.POST['name']
        
        if key:
            sample = Sample(id=key, name=name)
        else:
            sample = Sample(name=name)
        
        logger.debug('name    : %r' % name)
        
        #do save
        new_object = sample.save()
        logger.debug('new_object    : %r' % new_object)
        
        return HttpResponseRedirect(reverse('blueprint.views.sample_index'))
    else: 
        return HttpResponse(txt("invalid request."))
Ejemplo n.º 6
0
def item_create(request):
    if request.method == 'POST':
        #do save
        rawlinks = request.POST['links']
        links = rawlinks.splitlines()
        
        logger.debug('rawlinks    : %r' % rawlinks)
        logger.debug('links       : %r' % links)
        
        group = time.strftime("%Y%m%d_%H%M%S")
        for link in links:
            item = DownloadItem(group=group, path=link)
            logger.debug('item          : %r' % item)
            new_object = item.save()
            logger.debug('new_object    : %r' % new_object)
                
        return HttpResponseRedirect(reverse('pinti.views.item_index'))
    else: 
        return HttpResponse(txt("invalid request."))
Ejemplo n.º 7
0
def item_index(request, context={}):
    logger.debug('item_index <-')
    
    q = DownloadItem.objects.all().order_by('group', 'path')
    
    # Make sure page request is an int. If not, deliver first page.
    try:
        pagenum = int(request.GET.get('page', '1'))
    except ValueError:
        pagenum = 1
    logger.debug('pagenum : %d' % pagenum)

    context["title"] = txt('download items')
    context['result_headers'] = [
                                 {'text'  : txt('group'), },
                                 {'text'  : txt('path'), },
                                 {'text'  : txt('type'), },
                                 {'text'  : txt('status'), },
                                 {'text'  : txt('delete'), },
                                 ]
    return object_list(request, q, page=pagenum, paginate_by=50, template_name='pinti/item_list.html', extra_context=context)
def get_limb_measure(value):
    val = str(value)
    return txt(val.split('_')[0] + val.split('limb')[-1])
def get_sftr_movement(value):
    val = str(value)
    return txt(val.split('_sftr_')[1])
def get_joint_measure(value):
    val = str(value)
    return txt(val.split('joint_')[-1])