NoReverseMatch at /vacancy/2 Reverse for 'vacancy_search' with arguments '('Technology', '')' not found. 1 pattern(s) tried: ['search/\\Z']

13 views Asked by At

I have a model with a field occupation_area as a choice

class Vacancy(models.Model):
    name = models.CharField('Name', max_length=255)
    occupation_area = models.CharField(
        'Occupation area',
        max_length=3,
        choices=OCCUPATION_AREA_CHOICES
        )

and i have a filter area in my index that contains this field like "Occupation" which works fine

enter image description here

now, i have that's detail pages like above, and in those i have a link that must be taken to the index and pass the name of the occupation as a parameter to be filtered only something with these occupations

i tried this in the url:

<a href="{% url 'vacancies:vacancy_search' vacancy.get_occupation_area_display %}">Link</a>

but apresents this error, this is just a problem with the way i am passing the url??:

enter image description here

1

There are 1 answers

0
Paulo Mielnichuk On

It's difficult to say without the related view & url file. However there is somtehing wrong in the url. It should be:

<a href="{% url 'vacancies:vacancy_search' a=vacancy.get_occupation_area_display %}">Link</a>

being "a" the variable declared in the correspondent path in the urls.py file:

.../vacancies/<int:a>/

for example.