Question: I'm trying to return a vector from a function. My code compiles and I've checked my function and reckon that the error comes from the return part. It compiles fine (using Cygwin) but when running it, I get an Aborted (core dumped) error.
Here is my code:

```
#include <iostream>
#include <vector>
#include <string>
using namespace std;

//function that returns the square
int f(int n)
{
    return n*n;
}
vector<int> myVec;
int counter = 0;
//function that uses f on all elements in a list
vector<int> map(vector<int> something)
{
    //base case
    if(counter == something.size())
    {
        /*cout << "hello" << endl;
        for (int i=0; i<counter; i++)
        {
            cout << "vector: " << myVec[i] << endl;
        }*/
        counter=0;
        return myVec;
    }
    //recursion
    else
    {
        //cout << "counter: " << counter << endl;
        int n = f(something[counter]);
        //cout << "n: " << n << endl;
        myVec.push_back(n);
        //cout << "vector: " << myVec[counter] << endl;
        counter++;
        map(something);
    }
}

int main()
{
    //making vectors
    vector<int> L;
    vector<int> L1;
    vector<int> L2;
    for (int i=0; i<20; i++)
    {
        L.push_back(i);
    }
    L1 = map(L);
}

```

The code was originally from a class file.

Answer: 
You should iterate over the `candidates` QuerySet instead of the `lista2` list. Then you can do it like this:

```
{% for candidate in candidates %}
    <p class="tr">
        <a href="{% url 'candidate_detail' candidate.pk %}">{{ candidate }}</a>
    </p>
{% endfor %}

```
Replace `href` to the following:

```
{% load staticfiles %}
{% load mathfilters %}
<!DOCTYPE html>
<html>
<head>
    <title>Lista de candidatos</title>
    <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
    <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
    <link href="https://fonts.googleapis.com/css?family=Lobster&subset=latin,latin-ext" rel="stylesheet" type="text/css"> 
    <link href="{% static 'css/app.css' %}" rel="stylesheet">   
</head>
<body>
    <h1 class="h1t">Lista de Candidatos</h1>
    {% for l in lista2 %}
        <p class="tr"><a href="{% url 'candidate_detail' post.pk %}">{{l}}</a></p>
    {% endfor %}

</body>
</html>

```

In Django, when referencing a view using `url`, you need to use the `name` attribute that you have defined for it in the `urls.py` 

Screenshot from OP: file[![enter image description here](https://i.stack.imgur.com/IGvKp.png)](https://i.stack.imgur.com/IGvKp.png)