Try to fix issue 4

This commit is contained in:
2025-01-22 19:39:16 +09:00
parent 8b9326c360
commit 87096a3da4
3 changed files with 31 additions and 0 deletions

View File

@ -35,6 +35,9 @@ from .services.csv_processor import EntryCSVProcessor
class EntryAdmin(admin.ModelAdmin): class EntryAdmin(admin.ModelAdmin):
list_display = ['team', 'event', 'category', 'date', 'is_active'] list_display = ['team', 'event', 'category', 'date', 'is_active']
# change_list_templateの追加
change_list_template = 'admin/entry/change_list.html' # この行を追加
def get_urls(self): def get_urls(self):
from django.urls import path from django.urls import path
urls = super().get_urls() urls = super().get_urls()

View File

@ -0,0 +1,11 @@
{% extends "admin/change_list.html" %}
{% load i18n %}
{% block object-tools-items %}
{{ block.super }}
<li>
<a href="{% url 'admin:entry_upload_csv' %}" class="addlink">
{% translate "Upload CSV" %}
</a>
</li>
{% endblock %}

View File

@ -0,0 +1,17 @@
{% extends "admin/base_site.html" %}
{% load i18n static %}
{% block content %}
<div>
<form action="." method="post" enctype="multipart/form-data">
{% csrf_token %}
<div>
<label for="csv_file">Choose CSV file:</label>
<input type="file" name="csv_file" required>
</div>
<div style="margin-top: 20px;">
<input type="submit" value="Upload CSV">
</div>
</form>
</div>
{% endblock %}