Beispiel #1
0
def project_shopping_list(request):
	context = prepareContext(request)
	if('active_project' not in context):
		return redirect('cooking:projects')

	if('activate_inventory' in request.GET):
		request.session['inventory_active'] = True
	elif('deactivate_inventory' in request.GET):
		request.session['inventory_active'] = False
	elif('inventory_active' not in request.session):
		request.session['inventory_active'] = True

	if(request.session['inventory_active']):
		if('send_to_inventory' in request.GET):
			sl = project_shopping_list_data(context['active_project'])
			sl = subtract_inventory(context['active_project'], sl)
			for item in sl:
				add_to_inventory(context['active_project'], item)
		if('send_this_to_inventory' in request.GET):
			sl = project_shopping_list_data(context['active_project'])
			sl = subtract_inventory(context['active_project'], sl)
			ing = int(request.GET.get('item_id'))
			Ing = Ingredient.objects.get(id=ing)
			for item in sl:
				if(item.name == Ing.name):
					add_to_inventory(context['active_project'], item)

	context['shopping_list'] = project_shopping_list_data(context['active_project'])
	if(request.session['inventory_active']):
		context['shopping_list'] = subtract_inventory(context['active_project'], context['shopping_list'])
	#context['total_exact_price'] = context['shopping_list'].aggregate(tp=Sum('exact_price')).get('tp')
	context['total_effective_price'] = sum([float(x.effective_price) for x in context['shopping_list']])
	context['pagetitle'] = 'Shopping List'
	context['inventory_active'] = request.session['inventory_active']
	return render(request, 'listings/shopping_list.html', context)
Beispiel #2
0
def project_shopping_list(request):
    context = prepareContext(request)
    if ('active_project' not in context):
        return redirect('cooking:projects')

    if ('activate_inventory' in request.GET):
        request.session['inventory_active'] = True
    elif ('deactivate_inventory' in request.GET):
        request.session['inventory_active'] = False
    elif ('inventory_active' not in request.session):
        request.session['inventory_active'] = True

    if (request.session['inventory_active']):
        if ('send_to_inventory' in request.GET):
            sl = project_shopping_list_data(context['active_project'])
            sl = subtract_inventory(context['active_project'], sl)
            for item in sl:
                add_to_inventory(context['active_project'], item)

    context['shopping_list'] = project_shopping_list_data(
        context['active_project'])
    if (request.session['inventory_active']):
        context['shopping_list'] = subtract_inventory(
            context['active_project'], context['shopping_list'])
    #context['total_exact_price'] = context['shopping_list'].aggregate(tp=Sum('exact_price')).get('tp')
    context['total_effective_price'] = sum(
        [float(x.effective_price) for x in context['shopping_list']])
    context['pagetitle'] = 'Shopping List'
    context['inventory_active'] = request.session['inventory_active']
    return render(request, 'listings/shopping_list.html', context)
Beispiel #3
0
def project_shopping_list_csv(request):
	context = prepareContext(request)
	if('active_project' not in context):
		return redirect('cooking:projects')

	response = HttpResponse(content_type='text/csv')
	response['Content-Disposition'] = 'attachment; filename="shoppinglist.csv"'

	writer = UnicodeWriter(response)
	writer.writerow(['First Use', 'Ingredient', 'Exact Amount 1', '', 'Exact Amount 2', '', 'Effective Amount 1', '', 'Effective Amount 2', '', 'Buying Count', 'Effective Price', 'Remarks'])
	if('inventory_active' not in request.session):
		request.session['inventory_active'] = True
	shoppinglist = project_shopping_list_data(context['active_project'])
	if(request.session['inventory_active']):
		shoppinglist = subtract_inventory(context['active_project'], shoppinglist)
	for item in shoppinglist:
		if(item.exact_amount > 0):
			writer.writerow([item.first_occurrence,
				item.name,
				item.exact_amount,
				conv_measurement(item.buying_measurement, item.exact_amount),
				item.exact_calculation_amount,
				conv_measurement(item.calculation_measurement, item.exact_calculation_amount),
				item.effective_amount,
				conv_measurement(item.buying_measurement, item.effective_amount),
				item.effective_calculation_amount,
				conv_measurement(item.calculation_measurement, item.effective_calculation_amount),
				item.buying_count,
				item.effective_price,
				item.remarks])

	return response
Beispiel #4
0
def inventory(request):
    context = prepareContext(request)
    if ('inventory_active' not in request.session):
        request.session['inventory_active'] = True
    if ('remove_inventory_ingredient' in request.GET):
        try:
            Inventory_Item.objects.get(id=int(
                request.GET.get('remove_inventory_ingredient'))).delete()
        except:
            pass

    if ('activate_inventory' in request.GET):
        request.session['inventory_active'] = True
    elif ('deactivate_inventory' in request.GET):
        request.session['inventory_active'] = False

    if ('active_project' not in context):
        return redirect('cooking:projects')

    inv = Inventory_Item(project=context['active_project'])
    form = Inventory_ItemForm(request.POST or None, instance=inv)
    if (form.is_valid()):
        form.save()
        inv = Inventory_Item(project=context['active_project'])
        form = Inventory_ItemForm(None, instance=inv)

    context['form'] = form
    context['ingredient_list'] = inventory_data(context['active_project'])
    context['pagetitle'] = 'Inventory'
    context['inventory_active'] = request.session.get('inventory_active', True)
    return render(request, 'listings/inventory.html', context)
Beispiel #5
0
def list_receipe_ingredient(request, active_receipe):
	context = prepareContext(request)
	
	if('remove_receipe_ingredient' in request.GET):
		try:
			Receipe_Ingredient.objects.get(id=int(request.GET.get('remove_receipe_ingredient'))).delete()
		except:
			pass
	
	rec = receipe_data().get(id=active_receipe)
	form = Receipe_IngredientForm(request.POST or None)
	if(form.is_valid()):
		obj = form.save(commit=False)
		obj.receipe = rec
		obj.save()
		form = Receipe_IngredientForm(None)
	
	context['form'] = form
	context['receipe'] = rec
	context['receipe_ingredient_list'] = Receipe_Ingredient.objects.filter(receipe=rec).annotate(
			usage_count=Case(
				When(measurement=F('ingredient__calculation_measurement'), then=F('amount')/F('ingredient__calculation_quantity')),
				When(measurement=F('ingredient__buying_measurement'), then=F('amount')/F('ingredient__buying_quantity')),
				default=0,
				output_field=FloatField()
				)
		).annotate(
			price_per_person=ExpressionWrapper((F('usage_count') * F('ingredient__price'))/F('receipe__default_person_count'), output_field=FloatField()),
			weight_per_person=ExpressionWrapper((F('usage_count') * F('ingredient__cooked_weight'))/F('receipe__default_person_count'), output_field=FloatField()),
		)
	context['allergen_list'] = Allergen.objects.filter(ingredient__receipe=rec).distinct()
	for allergen in context['allergen_list']:
		allergen.used_in = ', '.join([x.name for x in allergen.ingredient_set.filter(receipe=rec)])
	context['pagetitle'] = 'Ingredients for Receipe'
	return render(request, 'listings/receipe_ingredient.html', context)
Beispiel #6
0
def inventory(request):
	context = prepareContext(request)
	if('inventory_active' not in request.session):
		request.session['inventory_active'] = True
	if('remove_inventory_ingredient' in request.GET):
		try:
			Inventory_Item.objects.get(id=int(request.GET.get('remove_inventory_ingredient'))).delete()
		except:
			pass
	
	if('activate_inventory' in request.GET):
		request.session['inventory_active'] = True
	elif('deactivate_inventory' in request.GET):
		request.session['inventory_active'] = False
	
	if('active_project' not in context):
		return redirect('cooking:projects')
	
	inv = Inventory_Item(project=context['active_project'])
	form = Inventory_ItemForm(request.POST or None, instance=inv)
	if(form.is_valid()):
		form.save()
		inv = Inventory_Item(project=context['active_project'])
		form = Inventory_ItemForm(None, instance=inv)
	
	context['form'] = form
	context['ingredient_list'] = inventory_data(context['active_project'])
	context['pagetitle'] = 'Inventory'
	context['inventory_active'] = request.session.get('inventory_active', True)
	return render(request, 'listings/inventory.html', context)
Beispiel #7
0
def list_meals(request):
	context = prepareContext(request)
	if('active_project' not in context):
		return redirect('cooking:projects')
	context['meals_list'] = Meal.objects.filter(project=context['active_project'])
	context['pagetitle'] = 'Meals'
	return render(request, 'listings/meals.html', context)
Beispiel #8
0
def list_meals(request):
    context = prepareContext(request)
    if ('active_project' not in context):
        return redirect('cooking:projects')
    context['meals_list'] = Meal.objects.filter(
        project=context['active_project'])
    context['pagetitle'] = 'Meals'
    return render(request, 'listings/meals.html', context)
Beispiel #9
0
def del_ingredient(request, ingredient):
    context = prepareContext(request)
    ing = Ingredient.objects.get(id=ingredient)
    form = ConfirmDeleteForm(request.POST or None)
    if (form.is_valid()):
        ing.delete()
        return redirect('cooking:ingredients')

    context['object'] = ing
    context['noaction'] = reverse('cooking:ingredients')
    context['form'] = form
    context['pagetitle'] = 'Delete Ingredient'
    return render(request, 'single/confirmdelete.html', context)
Beispiel #10
0
def del_meal(request, meal):
    context = prepareContext(request)
    m = Meal.objects.get(id=meal)
    form = ConfirmDeleteForm(request.POST or None)
    if (form.is_valid()):
        m.delete()
        return redirect('cooking:meals')

    context['object'] = m
    context['noaction'] = reverse('cooking:meals')
    context['form'] = form
    context['pagetitle'] = 'Delete Meal'
    return render(request, 'single/confirmdelete.html', context)
Beispiel #11
0
def edit_ingredient(request, ingredient):
    context = prepareContext(request)
    if (request.POST and 'id' in request.POST):
        ingredient = int(request.POST.get('id'))
    ing = Ingredient.objects.get(id=ingredient)
    form = IngredientForm(request.POST or None, instance=ing)
    if (form.is_valid()):
        form.save()
        context['submitted'] = True
    context['form'] = form
    context['name'] = ing.name
    context['pagetitle'] = 'Edit Ingredient'
    return render(request, 'single/defaultform.html', context)
Beispiel #12
0
def del_receipe(request, active_receipe):
	context = prepareContext(request)
	rec = Receipe.objects.get(id=active_receipe)
	form = ConfirmDeleteForm(request.POST or None)
	if(form.is_valid()):
		rec.delete()
		return redirect('cooking:receipes')
	
	context['object'] = rec
	context['noaction'] = reverse('cooking:receipes')
	context['form'] = form
	context['pagetitle'] = 'Delete Receipe'
	return render(request, 'single/confirmdelete.html', context)
Beispiel #13
0
def edit_project(request, project):
	context = prepareContext(request)
	if(request.POST and 'id' in request.POST):
		project = int(request.POST.get('id'))
	proj = Project.objects.get(id=project)
	form = ProjectForm(request.POST or None, instance=proj)
	if(form.is_valid()):
		form.save()
		context['submitted'] = True
	context['form'] = form
	context['name'] = proj.name
	context['pagetitle'] = 'Edit Project'
	return render(request, 'single/defaultform.html', context)
Beispiel #14
0
def del_meal(request, meal):
	context = prepareContext(request)
	m = Meal.objects.get(id=meal)
	form = ConfirmDeleteForm(request.POST or None)
	if(form.is_valid()):
		m.delete()
		return redirect('cooking:meals')
	
	context['object'] = m
	context['noaction'] = reverse('cooking:meals')
	context['form'] = form
	context['pagetitle'] = 'Delete Meal'
	return render(request, 'single/confirmdelete.html', context)
Beispiel #15
0
def del_ingredient(request, ingredient):
	context = prepareContext(request)
	ing = Ingredient.objects.get(id=ingredient)
	form = ConfirmDeleteForm(request.POST or None)
	if(form.is_valid()):
		ing.delete()
		return redirect('cooking:ingredients')
	
	context['object'] = ing
	context['noaction'] = reverse('cooking:ingredients')
	context['form'] = form
	context['pagetitle'] = 'Delete Ingredient'
	return render(request, 'single/confirmdelete.html', context)
Beispiel #16
0
def edit_ingredient(request, ingredient):
	context = prepareContext(request)
	if(request.POST and 'id' in request.POST):
		ingredient = int(request.POST.get('id'))
	ing = Ingredient.objects.get(id=ingredient)
	form = IngredientForm(request.POST or None, instance=ing)
	if(form.is_valid()):
		form.save()
		context['submitted'] = True
	context['form'] = form
	context['name'] = ing.name
	context['pagetitle'] = 'Edit Ingredient'
	return render(request, 'single/defaultform.html', context)
Beispiel #17
0
def del_receipe(request, active_receipe):
    context = prepareContext(request)
    rec = Receipe.objects.get(id=active_receipe)
    form = ConfirmDeleteForm(request.POST or None)
    if (form.is_valid()):
        rec.delete()
        return redirect('cooking:receipes')

    context['object'] = rec
    context['noaction'] = reverse('cooking:receipes')
    context['form'] = form
    context['pagetitle'] = 'Delete Receipe'
    return render(request, 'single/confirmdelete.html', context)
Beispiel #18
0
def edit_meal(request, meal):
    context = prepareContext(request)
    if (request.POST and 'id' in request.POST):
        meal = int(request.POST.get('id'))
    m = Meal.objects.get(id=meal)
    form = MealForm(request.POST or None, instance=m)
    if (form.is_valid()):
        form.save()
        context['submitted'] = True
    context['form'] = form
    context['meal'] = m
    context['name'] = m.name
    context['pagetitle'] = 'Edit Meal'
    return render(request, 'single/defaultform.html', context)
Beispiel #19
0
def edit_meal(request, meal):
	context = prepareContext(request)
	if(request.POST and 'id' in request.POST):
		meal = int(request.POST.get('id'))
	m = Meal.objects.get(id=meal)
	form = MealForm(request.POST or None, instance=m)
	if(form.is_valid()):
		form.save()
		context['submitted'] = True
	context['form'] = form
	context['meal'] = m
	context['name'] = m.name
	context['pagetitle'] = 'Edit Meal'
	return render(request, 'single/defaultform.html', context)
Beispiel #20
0
def edit_receipe(request, active_receipe):
    context = prepareContext(request)
    if (request.POST and 'id' in request.POST):
        active_receipe = int(request.POST.get('id'))
    rec = Receipe.objects.get(id=active_receipe)
    form = ReceipeForm(request.POST or None, instance=rec)
    if (form.is_valid()):
        form.save()
        context['submitted'] = 1
    context['name'] = rec.name
    context['active_page'] = 'receipes'
    context['form'] = form
    context['pagetitle'] = 'Edit Receipe'
    return render(request, 'single/defaultform.html', context)
Beispiel #21
0
def edit_receipe(request, active_receipe):
	context = prepareContext(request)
	if(request.POST and 'id' in request.POST):
		active_receipe = int(request.POST.get('id'))
	rec = Receipe.objects.get(id=active_receipe)
	form = ReceipeForm(request.POST or None, instance=rec)
	if(form.is_valid()):
		form.save()
		context['submitted'] = 1
	context['name'] = rec.name
	context['active_page'] = 'receipes'
	context['form'] = form
	context['pagetitle'] = 'Edit Receipe'
	return render(request, 'single/defaultform.html', context)
Beispiel #22
0
def new_ingredient(request):
	context = prepareContext(request)
	form = None
	if(request.POST):
		form = IngredientForm(data=request.POST or None)
		if(form.is_valid()):
			form.save()
			return redirect('cooking:ingredients')
	else:
		form = IngredientForm()
	
	context['form'] = form
	context['name'] = 'New Ingredient'
	context['pagetitle'] = 'New Ingredient'
	return render(request, 'single/defaultform.html', context)
Beispiel #23
0
def new_project(request):
	context = prepareContext(request)
	form = None
	if(request.POST):
		form = ProjectForm(data=request.POST or None)
		if(form.is_valid()):
			form.save()
			return redirect('cooking:projects')
	else:
		form = ProjectForm()
	
	context['form'] = form
	context['name'] = 'New Project'
	context['pagetitle'] = 'New Project'
	return render(request, 'single/defaultform.html', context)
Beispiel #24
0
def meal_receipe_shopping_list(request, meal, receipe):
	context = prepareContext(request)
	if('active_project' not in context):
		return redirect('cooking:projects')
	
	#context['shopping_list'] = Meal_Receipe_Shopping_List.objects.filter(project_id=context['active_project'].id, meal_id=meal, receipe_id=receipe)
	context['meal'] = Meal.objects.get(id=meal)
	context['receipe'] = Receipe.objects.get(id=receipe)
	context['shopping_list'] = meal_shopping_list(context['meal'], context['receipe'])
	context['total_exact_price'] = context['shopping_list'].aggregate(tp=Sum('exact_price')).get('tp')
	context['allergen_list'] = Allergen.objects.filter(ingredient__receipe=context['receipe']).distinct()
	for allergen in context['allergen_list']:
		allergen.used_in = ', '.join([x.name for x in allergen.ingredient_set.filter(receipe=context['receipe'])])
	context['pagetitle'] = 'Meal-specific Shopping List'
	return render(request, 'listings/meal_receipe_shopping_list.html', context)
Beispiel #25
0
def new_receipe(request):
	context = prepareContext(request)
	form = None
	if(request.POST):
		form = ReceipeForm(data=request.POST or None)
		if(form.is_valid()):
			form.save()
			return redirect('cooking:receipes')
	else:
		form = ReceipeForm()
	context['name'] ='New Receipe'
	context['active_page'] = 'receipes'
	context['form'] = form
	context['pagetitle'] = 'New Receipe'
	return render(request, 'single/defaultform.html', context)
Beispiel #26
0
def new_receipe(request):
    context = prepareContext(request)
    form = None
    if (request.POST):
        form = ReceipeForm(data=request.POST or None)
        if (form.is_valid()):
            form.save()
            return redirect('cooking:receipes')
    else:
        form = ReceipeForm()
    context['name'] = 'New Receipe'
    context['active_page'] = 'receipes'
    context['form'] = form
    context['pagetitle'] = 'New Receipe'
    return render(request, 'single/defaultform.html', context)
Beispiel #27
0
def new_meal(request):
	context = prepareContext(request)
	form = None
	meal = Meal(project=context['active_project'])
	if(request.POST):
		form = MealForm(data=request.POST or None, instance=meal)
		if(form.is_valid()):
			form.save()
			return redirect('cooking:meals')
	else:
		form = MealForm(instance=meal)
	
	context['form'] = form
	context['name'] = 'New Meal'
	context['pagetitle'] = 'New Meal'
	return render(request, 'single/defaultform.html', context)
Beispiel #28
0
def new_meal(request):
    context = prepareContext(request)
    form = None
    meal = Meal(project=context['active_project'])
    if (request.POST):
        form = MealForm(data=request.POST or None, instance=meal)
        if (form.is_valid()):
            form.save()
            return redirect('cooking:meals')
    else:
        form = MealForm(instance=meal)

    context['form'] = form
    context['name'] = 'New Meal'
    context['pagetitle'] = 'New Meal'
    return render(request, 'single/defaultform.html', context)
Beispiel #29
0
def list_allergens(request):
    context = prepareContext(request)

    if "remove_allergen" in request.GET:
        try:
            Allergen.objects.get(id=int(request.GET.get("remove_allergen"))).delete()
        except:
            pass

    form = AllergenForm(request.POST or None)
    if form.is_valid():
        form.save()
        form = AllergenForm(None)

    context["form"] = form
    context["allergen_list"] = Allergen.objects.all()
    context["pagetitle"] = "Allergens"
    return render(request, "listings/allergens.html", context)
Beispiel #30
0
def del_project(request, project):
	context = prepareContext(request)
	proj = Project.objects.get(id=project)
	form = ConfirmDeleteForm(request.POST or None)
	if(form.is_valid()):
		proj.delete()
		try:
			del request.session['active_project']
		except:
			pass
		return redirect('cooking:projects')
	
	
	context['object'] = proj
	context['noaction'] = reverse('cooking:projects')
	context['form'] = form
	context['pagetitle'] = 'Delete Project'
	return render(request, 'single/confirmdelete.html', context)
def list_receipe_ingredient(request, active_receipe):
    context = prepareContext(request)

    if ('remove_receipe_ingredient' in request.GET):
        try:
            Receipe_Ingredient.objects.get(
                id=int(request.GET.get('remove_receipe_ingredient'))).delete()
        except:
            pass

    rec = receipe_data().get(id=active_receipe)
    form = Receipe_IngredientForm(request.POST or None)
    if (form.is_valid()):
        obj = form.save(commit=False)
        obj.receipe = rec
        obj.save()
        form = Receipe_IngredientForm(None)

    context['form'] = form
    context['receipe'] = rec
    context['receipe_ingredient_list'] = Receipe_Ingredient.objects.filter(
        receipe=rec).annotate(usage_count=Case(
            When(measurement=F('ingredient__calculation_measurement'),
                 then=F('amount') / F('ingredient__calculation_quantity')),
            When(measurement=F('ingredient__buying_measurement'),
                 then=F('amount') / F('ingredient__buying_quantity')),
            default=0,
            output_field=FloatField())).annotate(
                price_per_person=ExpressionWrapper(
                    (F('usage_count') * F('ingredient__price')) /
                    F('receipe__default_person_count'),
                    output_field=FloatField()),
                weight_per_person=ExpressionWrapper(
                    (F('usage_count') * F('ingredient__cooked_weight')) /
                    F('receipe__default_person_count'),
                    output_field=FloatField()),
            )
    context['allergen_list'] = Allergen.objects.filter(
        ingredient__receipe=rec).distinct()
    for allergen in context['allergen_list']:
        allergen.used_in = ', '.join(
            [x.name for x in allergen.ingredient_set.filter(receipe=rec)])
    context['pagetitle'] = 'Ingredients for Receipe'
    return render(request, 'listings/receipe_ingredient.html', context)
Beispiel #32
0
def list_allergens(request):
    context = prepareContext(request)

    if ('remove_allergen' in request.GET):
        try:
            Allergen.objects.get(
                id=int(request.GET.get('remove_allergen'))).delete()
        except:
            pass

    form = AllergenForm(request.POST or None)
    if (form.is_valid()):
        form.save()
        form = AllergenForm(None)

    context['form'] = form
    context['allergen_list'] = Allergen.objects.all()
    context['pagetitle'] = 'Allergens'
    return render(request, 'listings/allergens.html', context)
Beispiel #33
0
def project_csv(request):
	context = prepareContext(request)
	if('active_project' not in context):
		return redirect('cooking:projects')
	response = HttpResponse(content_type='text/csv')
	response['Content-Disposition'] = 'attachment; filename="' + context['active_project'].name + '.csv"'
	
	writer = UnicodeWriter(response)
	
	allmeals = Meal.objects.filter(project=context['active_project'])
	for meal in allmeals:
		allreceipes = meal.used_receipes.all()
		for receipe in allreceipes:
			allingredients = receipe.ingredients.all()
			for ing in allingredients:
				#shopping_item = Meal_Receipe_Shopping_List.objects.get(project_id=context['active_project'].id, meal_id=meal.id, receipe_id=receipe.id, ing_id=ing.id)
				pass
			
	
	return response
Beispiel #34
0
def list_meal_receipe(request, meal):
	context = prepareContext(request)
	
	if('remove_meal_receipe' in request.GET):
		try:
			Meal_Receipe.objects.get(id=int(request.GET.get('remove_meal_receipe'))).delete()
		except:
			pass
	
	m = Meal.objects.get(id=meal)
	m_rec = Meal_Receipe(meal=m)
	form = Meal_ReceipeForm(request.POST or None, instance=m_rec)
	if(form.is_valid()):
		form.save()
		form = Meal_ReceipeForm(None)
	
	context['form'] = form
	context['meal'] = m
	context['meal_receipe_list'] = meal_receipe_data(m)
	context['pagetitle'] = 'Receipes in Meal'
	return render(request, 'listings/meal_receipe.html', context)
Beispiel #35
0
def project_shopping_list_csv(request):
    context = prepareContext(request)
    if ('active_project' not in context):
        return redirect('cooking:projects')

    response = HttpResponse(content_type='text/csv')
    response['Content-Disposition'] = 'attachment; filename="shoppinglist.csv"'

    writer = UnicodeWriter(response)
    writer.writerow([
        'First Use', 'Ingredient', 'Exact Amount 1', '', 'Exact Amount 2', '',
        'Effective Amount 1', '', 'Effective Amount 2', '', 'Buying Count',
        'Effective Price', 'Remarks'
    ])
    if ('inventory_active' not in request.session):
        request.session['inventory_active'] = True
    shoppinglist = project_shopping_list_data(context['active_project'])
    if (request.session['inventory_active']):
        shoppinglist = subtract_inventory(context['active_project'],
                                          shoppinglist)
    for item in shoppinglist:
        if (item.exact_amount > 0):
            writer.writerow([
                item.first_occurrence, item.name, item.exact_amount,
                conv_measurement(item.buying_measurement, item.exact_amount),
                item.exact_calculation_amount,
                conv_measurement(item.calculation_measurement,
                                 item.exact_calculation_amount),
                item.effective_amount,
                conv_measurement(item.buying_measurement,
                                 item.effective_amount),
                item.effective_calculation_amount,
                conv_measurement(item.calculation_measurement,
                                 item.effective_calculation_amount),
                item.buying_count, item.effective_price, item.remarks
            ])

    return response
Beispiel #36
0
def list_ingredients(request):
    context = prepareContext(request)
    context['ingredient_list'] = Ingredient.objects.all()
    context['pagetitle'] = 'Ingredients'
    return render(request, 'listings/ingredients.html', context)
Beispiel #37
0
def list_projects(request):
	context = prepareContext(request)
	context['project_list'] = Project.objects.all()
	context['pagetitle'] = 'Overview'
	return render(request, 'listings/projects.html', context)
Beispiel #38
0
def list_receipes(request):
	context = prepareContext(request)
	context['receipe_list'] = receipe_data()
	context['pagetitle'] = 'Receipes'
	return render(request, 'listings/receipes.html', context)
Beispiel #39
0
def list_ingredients(request):
	context = prepareContext(request)
	context['ingredient_list'] = Ingredient.objects.all()
	context['pagetitle'] = 'Ingredients'
	return render(request, 'listings/ingredients.html', context)
Beispiel #40
0
def list_receipes(request):
    context = prepareContext(request)
    context['receipe_list'] = receipe_data()
    context['pagetitle'] = 'Receipes'
    return render(request, 'listings/receipes.html', context)