(request, uid)
return render(request, 'recipe_view.html', context)
Edit meta-data associated with a recipe.
Edit meta-data associated with a recipe.
Edit meta - data associated with a recipe .
def recipe_view(request, uid):
    """
    Edit meta-data associated with a recipe.
    """

    # The user making the request.
    user = request.user

    # The recipe that needs to be edited.
    recipe = Analysis.objects.filter(uid=uid).annotate(
            job_count=Count("job", filter=Q(job__deleted=False))
        ).first()

    # The project that recipe belongs to.
    project = recipe.project

    # Initial form loading via a GET request.
    form = forms.RecipeForm(instance=recipe, user=request.user, project=project)

    # Fills in project level counts (results, data and recipe counts).
    counts = get_counts(project)

    # Disable buttons if project not writeable.
    btn_state = '' if auth.is_writable(user=user, project=project) else 'disabled'

    # Get the list of jobs required to view recipe results
    jobs = recipe.job_set.filter(deleted=False).order_by("-lastedit_date").all()

    # Check to see if this recipe is runnable by the user.
    is_runnable = auth.authorize_run(user=user, recipe=recipe)

    # Check to see if recipe is editable
    editable = auth.writeable_recipe(user=user, source=recipe)

    # Generate the context.
    context = dict(recipe=recipe, job_list=jobs, project=project, form=form, btn_state=btn_state,
                   is_runnable=is_runnable, activate='Recipe View', rerun_btn=False,
                   include_copy=False, editable=editable)

    # Update context with counts.
    context.update(counts)

    return render(request, 'recipe_view.html', context)
def recipe_view ( request , uid ) : # The user making the request. user = request . user # The recipe that needs to be edited. recipe = Analysis . objects . filter ( uid = uid ) . annotate ( job_count = Count ( "job" , filter = Q ( job__deleted = False ) ) ) . first ( ) # The project that recipe belongs to. project = recipe . project # Initial form loading via a GET request. form = forms . RecipeForm ( instance = recipe , user = request . user , project = project ) # Fills in project level counts (results, data and recipe counts). counts = get_counts ( project ) # Disable buttons if project not writeable. btn_state = '' if auth . is_writable ( user = user , project = project ) else 'disabled' # Get the list of jobs required to view recipe results jobs = recipe . job_set . filter ( deleted = False ) . order_by ( "-lastedit_date" ) . all ( ) # Check to see if this recipe is runnable by the user. is_runnable = auth . authorize_run ( user = user , recipe = recipe ) # Check to see if recipe is editable editable = auth . writeable_recipe ( user = user , source = recipe ) # Generate the context. context = dict ( recipe = recipe , job_list = jobs , project = project , form = form , btn_state = btn_state , is_runnable = is_runnable , activate = 'Recipe View' , rerun_btn = False , include_copy = False , editable = editable ) # Update context with counts. context . update ( counts ) return render ( request , 'recipe_view.html' , context )