How can I print the vocabulary name instead of the referenced term in a node template?

Let’s say I have a content type article with a field “taxonomy”.

The vocabulary is “fruits”.

The terms are “apple”, “orange”, “bananas”

The article belongs to “orange”.

I can easily print in my twig template the term of the article :

{{ content.field_taxo_fruit }} 

Result is “orange”.

But I don’t find an easy way to print the vocabulary : “fruits”.

On an other project, I used views field and I used “rewrite result”. But here, I use twig template like node--article--teaser.html.twig

Error “The referenced file ‘/_catalogs/mycustompage.master’ is not allowed on this page.” when using custom master page in application page

I am trying to use customer master page in my application page but getting following error:

Error

The referenced file ‘/_catalogs/mycustompage.master’ is not allowed on this page.

Code

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SomeCode.aspx.cs" Inherits="SomeCode.Code" MasterPageFile="~/_catalogs/mycustompage.master" %> 

How do I fix this issue?

How shoud domain services be referenced?

I’m working on a test project, with the intention of using DDD.

So far I have this basic project structure:

enter image description here

My question is: How should the Core.Domain.Services be referenced? do I create an interfaces project like what I did for the application services, and use Dependency Injection ?

If so, where does such a project belong?

( I will reference this great poste just so we can be clear on my opinion on the when to create a domain service and what to avoid in order not to fall for antipatterns: Domain Services vs Application Services )

Entity reference field dependent on entity reference in referenced entity of another entity reference field

I have a content type ‘order’ with 2 entity reference fields. One is a reference to another content type ‘brand’ and the other is a reference to a taxonomy term ‘categories’.

Now the content type ‘brand’ has an entity reference field aswell, containing a selection of taxonomy term ‘categories’.

When creating a new ‘order’ I can select a ‘brand’. Now the second field with the ‘categories’ should only show taxonomy terms available (selected) for the selected ‘brand’.

I have tried to achieve this with the second entity reference field (categories) to use a view.

In this view I configured the following:

Relations: – Content using field_categories – Content referenced from field_brand

This worked when I had only 1 brand, since this brand was not connected to all categories. But now with multiple brands, the view just returns all the terms used in ALL brands.

Any idea how to achieve what I try? Any help is very appreciated. Thank you!

How to validate field in inline entity form referenced field

I have created field “Referenced” which is entity reference field of other content type. Also this field have inline entity form functionality means its giving two button “add new node” and “and existing node”

Once we clicked on “add new node”, publication content type node form will open. i want to make field_author entity reference field inside the inline entity form

unknown module referenced: app

Хочу с помощью terraform установить несколько инстансов и при загрузе появляется следующие ошибки: Error: output ‘app_external_ip’: unknown module referenced: app Error: output ‘app_external_ip’: reference to undefined module “app” Error: output ‘app_external_ip’: unknown module referenced: app Error: output ‘app_external_ip’: reference to undefined module “app”

структура проекта:

├── files │   ├── deploy.sh │   └── puma.service ├── main.tf ├── modules │   ├── app │   │   ├── main.tf │   │   ├── outputs.tf │   │   └── variables.tf │   └── db │       ├── main.tf │       ├── outputs.tf │       └── variables.tf ├── outputs_old ├── ssh │   ├── privat.ppk │   └── public.pub ├── terraform.tfstate ├── terraform.tfstate.backup ├── terraform.tfvars ├── variables.tf └── vpc.tf 

структура файла “outputs.tf”:

output "app_external_ip"  { value = "$  {module.app.app_external_ip}" } 

Django local variable ‘form’ referenced before assignment

I m trying to make a form where user enter the state and weather of that location is given back

It was working fine untill I added cities = City.objects.all() in the code

from django.shortcuts import render import requests from .models import City

def index(request): cities = City.objects.all() #return all the cities in the database

    url = 'http://api.openweathermap.org/data/2.5/weather?q={}&units=imperial&appid=ec2052730c7fdc28b89a0fbfe8560346'      if request.method == 'POST': # only true if form is submitted             form = CityForm(request.POST) # add actual request data to form for processing     form.save() # will validate and save if validate      form = CityForm()     weather_data = []      for city in cities:              city_weather = requests.get(url.format(city)).json() #request the API data and convert the JSON to Python data types              weather = {             'city' : city,             'temperature' : city_weather['main']['temp'],             'description' : city_weather['weather'][0]['description'],             'icon' : city_weather['weather'][0]['icon']             }              weather_data.append(weather) #add the data for the current city into our list      context = {'weather_data' : weather_data, 'form' : form}     return render(request, 'weathers/index.html', context) 

UnboundLocalError at / local variable ‘form’ referenced before assignment Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 2.2.1 Exception Type: UnboundLocalError Exception Value: local variable ‘form’ referenced before assignment Exception Location: C:\Users\Admin\Desktop\the_weather\weathers\views.py in index, line 12 Python Executable: C:\Users\Admin\AppData\Local\Programs\Python\Python37-32\python.exe Python Version: 3.7.3 Python Path: [‘C:\Users\Admin\Desktop\the_weather’, ‘C:\Users\Admin\AppData\Local\Programs\Python\Python37-32\python37.zip’, ‘C:\Users\Admin\AppData\Local\Programs\Python\Python37-32\DLLs’, ‘C:\Users\Admin\AppData\Local\Programs\Python\Python37-32\lib’, ‘C:\Users\Admin\AppData\Local\Programs\Python\Python37-32’, ‘C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages’, ‘C:\Users\Admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages’] Server time: Fri, 24 May 2019 04:09:08 +0000

How to print the relative url or node id for each referenced node in twig?

I am using paragraphs to render a number of nodes on a page. The nodes are obtained through an entity reference field called ‘field_nodeslist’ in my cards paragraph type. The cards are then rendered using a custom view layout.

Here is a snippet of my view layout:

<a href="????">    <h3>{{ content.top_region|strip tags}}</h3>    <p>{{ content.middle_region }}</p> </a> 

The problem I am having is printing the relative path for each referenced node. I have tried the following twig commands but have not any success so far:

<a href="{{ url }}"> <a href="{{ uri }}"> <a href="{{ node.id }}"> <a href="{{ link }}"> <a href"{{ content.field.0['#url'] }}"> 

The following allows me to manually specify the node id in twig however that’s not what I am looking for:

<a href="{{ path('entity.node.canonical', {'node': 6 }) }}"> 

Any ideas?