why this is not working? I can't concatenate the filter with another variable?
I have a feeling that I'm being very dumb.
I'm new at django and trying a couple of things with the model.
When I use: birthdate__contains='-03-' works fine, but with the variable, nothing shows up at the url
from django.shortcuts import render from .models import Employee from datetime import datetime
# Create your views here.
def index(request):
currentMonth = datetime.now().month
mes_atual = '-'+str(currentMonth)+'-'
employees = Employee.objects.filter(
birthdate__contains=mes_atual
)
context = {
'employees' : employees
}
return render(request, 'index.html', context)
thanks in advance