# index.html
<tbody>
{% {% for post in job_opening %}
<tr>
<td>{{ post.title }}</td>
<td>{{ post.target }}</td>
<td>{{ post.department }}</td>
<td>{{ post.period }}</td>
<td> Button</td>
</tr>
{% {% endfor %}
</tbody>
# view.py
def index(request):
template = loader.get_template('mainapp/index.html')
post = job_opening.objects.all()
context = {'post' : post}
return render(request, 'mainapp/index.html', context)
# models.py
class job_opening(models.Model):
title = models.CharField(max_length=200,verbose_name='title')
target = models.CharField(max_length=50)
department = models.CharField(max_length=10)
period = models.CharField(max_length=50)
content = models.TextField()
def __str__(self):
return self.title
Add job_opening in admin
When I turn on the site, I can't print it out to the table...ㅜ<
djago-model django django-view
I think it's confusing because similar names are repeated. If you change the sauce like this, it'll probably work.
# view.py
foo = job_opening.objects.all()
bar = {'dee' : foo}
return render(request, 'mainapp/index.html', bar)
<!-- index.html -->
{% {% for post in dee %}
© 2024 OneMinuteCode. All rights reserved.