From c3c5a44be58df625af2d98bc2f9110283dffe514 Mon Sep 17 00:00:00 2001 From: corsaronero Date: Thu, 17 Nov 2022 17:39:43 +0000 Subject: [PATCH] added date hierarchy and overview in admin panel to all other forms in admin.py, also created variable intern_notes --- input/admin.py | 81 ++++++++++++++++--- ...ficate_intern_notes_travel_intern_notes.py | 23 ++++++ input/models.py | 2 +- 3 files changed, 94 insertions(+), 12 deletions(-) create mode 100644 input/migrations/0071_honorarycertificate_intern_notes_travel_intern_notes.py diff --git a/input/admin.py b/input/admin.py index f617d8e..eff2e5e 100644 --- a/input/admin.py +++ b/input/admin.py @@ -42,24 +42,83 @@ class BusinessCardAdmin(admin.ModelAdmin): list_display = ('realname', 'service_id', 'granted', 'granted_date', 'project') list_display_links = ('realname', 'service_id') # action = ['export_as_csv'] - + date_hierarchy = 'granted_date' class Media: js = ('dropdown/js/base.js',) @admin.register(Literature) class LiteratureAdmin(admin.ModelAdmin): - + save_as = True + search_fields = (('realname', 'service_id'), 'granted', 'granted_date') + list_display = ('realname', 'service_id', 'granted', 'granted_date') + list_display_links = ('realname', 'service_id') + date_hierarchy = 'granted_date' class Media: js = ('dropdown/js/base.js',) +@admin.register(Account) +class AccountAdmin(admin.ModelAdmin): + save_as = True + + +@admin.register(HonoraryCertificate) +class HonoraryCertificateAdmin(admin.ModelAdmin): + save_as = True + search_fields = ('realname', 'granted', 'granted_date', 'project') + list_display = ('realname', 'granted', 'granted_date', 'project') + list_display_links = ('realname', 'project') + date_hierarchy = 'granted_date' + +@admin.register(Library) +class LibraryAdmin(admin.ModelAdmin): + save_as = True + search_fields = (('realname', 'service_id'), 'granted', 'granted_date') + list_display = ('realname', 'service_id', 'granted', 'granted_date') + list_display_links = ('realname', 'service_id') + date_hierarchy = 'granted_date' + +@admin.register(IFG) +class IFGAdmin(admin.ModelAdmin): + save_as = True + search_fields = (('realname', 'service_id'), 'granted', 'granted_date') + list_display = ('realname', 'service_id', 'granted', 'granted_date') + list_display_links = ('realname', 'service_id') + date_hierarchy = 'granted_date' + +@admin.register(Travel) +class TravelAdmin(admin.ModelAdmin): + save_as = True + search_fields = ('realname', 'granted', 'granted_date', 'project') + list_display = ('realname', 'granted', 'granted_date', 'project') + list_display_links = ('realname', 'project') + date_hierarchy = 'granted_date' + +@admin.register(Email) +class EmailAdmin(admin.ModelAdmin): + save_as = True + search_fields = (('realname', 'service_id'), 'granted', 'granted_date') + list_display = ('realname', 'service_id', 'granted', 'granted_date') + list_display_links = ('realname', 'service_id') + date_hierarchy = 'granted_date' + -admin.site.register([ - Account, - HonoraryCertificate, - Library, - IFG, - Travel, - Email, - List, - ]) +@admin.register(List) +class ListAdmin(admin.ModelAdmin): + save_as = True + search_fields = (('realname', 'service_id'), 'granted', 'granted_date') + list_display = ('realname', 'service_id', 'granted', 'granted_date') + list_display_links = ('realname', 'service_id') + date_hierarchy = 'granted_date' + +# commented out because of the individual registering to control displays in admin panel + +#admin.site.register([ +# Account, +# HonoraryCertificate, +# Library, +# IFG, +# Travel, +# Email, +# List, +# ]) diff --git a/input/migrations/0071_honorarycertificate_intern_notes_travel_intern_notes.py b/input/migrations/0071_honorarycertificate_intern_notes_travel_intern_notes.py new file mode 100644 index 0000000..ed4f2df --- /dev/null +++ b/input/migrations/0071_honorarycertificate_intern_notes_travel_intern_notes.py @@ -0,0 +1,23 @@ +# Generated by Django 4.1.2 on 2022-11-17 17:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('input', '0070_alter_travel_project'), + ] + + operations = [ + migrations.AddField( + model_name='honorarycertificate', + name='intern_notes', + field=models.TextField(blank=True, max_length=1000), + ), + migrations.AddField( + model_name='travel', + name='intern_notes', + field=models.TextField(blank=True, max_length=1000), + ), + ] diff --git a/input/models.py b/input/models.py index a92ff61..703c43d 100644 --- a/input/models.py +++ b/input/models.py @@ -119,7 +119,7 @@ class Project(Volunteer): class Intern(Volunteer): '''abstrat base class for data entry from /intern (except Project)''' request_url = models.URLField(max_length=2000, verbose_name='Antrag (URL)') - + intern_notes = models.TextField(max_length=1000, blank=True) class Meta: abstract = True