Browse Source

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

master
alpcentaur 1 year ago
parent
commit
f58ac52109
3 changed files with 94 additions and 12 deletions
  1. +70
    -11
      input/admin.py
  2. +23
    -0
      input/migrations/0071_honorarycertificate_intern_notes_travel_intern_notes.py
  3. +1
    -1
      input/models.py

+ 70
- 11
input/admin.py 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.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,
# ])

+ 23
- 0
input/migrations/0071_honorarycertificate_intern_notes_travel_intern_notes.py 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),
),
]

+ 1
- 1
input/models.py 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

Loading…
Cancel
Save