1
0
Fork 0

added date hierarchy and overview in admin panel to all other forms in admin.py, also created variable intern_notes

This commit is contained in:
corsaronero 2022-11-17 17:39:43 +00:00
parent 687fdddb8e
commit c3c5a44be5
3 changed files with 94 additions and 12 deletions

View File

@ -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.site.register([
Account,
HonoraryCertificate,
Library,
IFG,
Travel,
Email,
List,
])
@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.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,
# ])

View File

@ -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),
),
]

View File

@ -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