Этот код работает без ошибок, но он не показывает '{{skill.skillName}}
' в шаблоне, так в чем же проблема?
это результат, когда я пытаюсь напечатать skills
изviews
<QuerySet [<Skill: nope>, <Skill: yep>, <Skill: yes>]>
models.py
class User_Model(models.Model):
firstname = models.CharField(max_length=100)
lastname = models.CharField(max_length=100)
user = models.OneToOneField(User, on_delete=models.CASCADE)
country = models.CharField(max_length=50)
city = models.CharField(max_length=50)
job = models.CharField(max_length=100)
phoneNumber = models.PositiveIntegerField()
description = models.CharField(max_length=600)
profilePicture = models.ImageField(upload_to='users/', default='users/user-man1.jpg')
def __str__(self):
return self.user.username
class Skill(models.Model):
skillName = models.CharField(max_length=30, null=True)
user = models.ManyToManyField(User)
def __str__(self):
return self.skillName
views.py
def memberOnlyDetail(request, username):
user = User.objects.get(username=username)
skills = Skill.objects.filter(user=user)
memberDetails =User_Model.objects.get(user=user)
return render(request, 'memberMemberProfilePage.html', {'memberDetails': memberDetails}, {'skills': skills})
enter code here
memberMemberProfilePage.html
{%for skill in skills%}
<div class="col-lg-2 col-md-3 col-sm-6 hvr-grow-rotate">
<p>{{skill1.skillName}}</p>
</div>
{%endfor%}