79124406

Date: 2024-10-25 05:57:55
Score: 0.5
Natty:
Report link

it works now after update views.py like this

img_file = request.FILES.get('imgg')
     try:
     employee = Employee.objects.create(
     img=img_file


 employee.save()  # This should trigger the print/log statements

list.html

{% if datas.employee.img %}
            <img src="{{ datas.employee.img.url }}" alt="User Avatar" class="user-avatar">
        {% else %}
            <img src="{% static 'path/to/default/image.png' %}" alt="Default Avatar" class="user-avatar">
        {% endif %}

enter code here
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Julian divagaran