筒井です。 「2」についてはdjango-admin-rangefilterというサードパーティライブラリでできます。 https://github.com/silentsokolov/django-admin-rangefilter <https://github.com/silentsokolov/django-admin-rangefilter>
「1」については私が知る限り該当するライブラリはありませんが、以下公式ドキュメントを参考にして自分で実装するのはそんなに難しくないと思います。 https://docs.djangoproject.com/ja/2.1/howto/outputting-csv/ <https://docs.djangoproject.com/ja/2.1/howto/outputting-csv/> ModelAdminの「actions」というフィールドに上記関数を設定することで、管理画面にカスタムアクションを追加することができます。 https://docs.djangoproject.com/ja/2.1/ref/contrib/admin/actions/ <https://docs.djangoproject.com/ja/2.1/ref/contrib/admin/actions/> 例として、Bookというモデルを対象にして以下のadmin.pyを作ってみました。Django2.1.7を使っていますが、古いバージョンでも動くはずです。 import csv from django.contrib import admin from django.http.response import HttpResponse from rangefilter.filter import DateRangeFilter from .models import Book def export_as_csv(modeladmin, request, queryset): meta = modeladmin.model._meta field_names = [field.name for field in meta.fields] response = HttpResponse(content_type='text/csv') response['Content-Disposition'] = f'attachment; filename={meta.label_lower}.csv' writer = csv.writer(response) writer.writerow(field_names) for obj in queryset: writer.writerow([getattr(obj, field) for field in field_names]) return response export_as_csv.short_description = "CSVエクスポート" class BookAdmin(admin.ModelAdmin): list_filter = ( ('published_at', DateRangeFilter), ) actions = (export_as_csv,) admin.site.register(Book, BookAdmin) > 2019/02/22 16:49、Jun Tanaka <tna...@gmail.com>のメール: > > 田中と申します。 > > djangoの管理画面でのtimestampにてわからないことがありまして質問させていただきます。 > > 下記のような Django のモジュール知っている方いらしたらご紹介いただけないでしょうか > > 1 管理画面でtimestampの日付の範囲でデータを CSV に吐き出しをしたい。 > 2 管理画面のUIにカレンダーが出てきて区間を指定できるような方法が望ましいです。 > 上記を解決するモジュールありませんでしょうか 。 > ご存知でしたら教えていただけると幸いです 。 > > 宜しくお願い致します。 > > > -- > ----------------- http://djangoproject.jp/ <http://djangoproject.jp/> > ----------------- > You received this message because you are subscribed to the Google Groups > "django-ja" group. > To post to this group, send email to django-ja@googlegroups.com > To unsubscribe from this group, send email to > django-ja-unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/django-ja > <http://groups.google.com/group/django-ja> > --- > このメールは Google グループのグループ「django-ja」に登録しているユーザーに送られています。 > このグループから退会し、グループからのメールの配信を停止するには django-ja+unsubscr...@googlegroups.com > <mailto:django-ja+unsubscr...@googlegroups.com> にメールを送信してください。 > その他のオプションについては https://groups.google.com/d/optout > <https://groups.google.com/d/optout> にアクセスしてください。 -- ----------------- http://djangoproject.jp/ ----------------- You received this message because you are subscribed to the Google Groups "django-ja" group. To post to this group, send email to django-ja@googlegroups.com To unsubscribe from this group, send email to django-ja-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-ja --- このメールは Google グループのグループ「django-ja」の登録者に送られています。 このグループから退会し、グループからのメールの配信を停止するには django-ja+unsubscr...@googlegroups.com にメールを送信してください。 その他のオプションについては、https://groups.google.com/d/optout にアクセスしてください。