Browse Source

admin search bar working now for all models, gave a 500 error because of wrong syntax in admin.py - searchfields

master
Benni Bärmann 2 years ago
parent
commit
4d7b48f8b8
2 changed files with 7 additions and 7 deletions
  1. +6
    -6
      input/admin.py
  2. +1
    -1
      input/models.py

+ 6
- 6
input/admin.py View File

@ -38,7 +38,7 @@ class ProjectAdmin(admin.ModelAdmin):
@admin.register(BusinessCard) @admin.register(BusinessCard)
class BusinessCardAdmin(admin.ModelAdmin): class BusinessCardAdmin(admin.ModelAdmin):
save_as = True save_as = True
search_fields = (('realname', 'service_id'), 'granted', 'granted_date', 'project')
search_fields = ('realname', 'service_id', 'granted', 'granted_date', 'project')
list_display = ('realname', 'service_id', 'granted', 'granted_date', 'project') list_display = ('realname', 'service_id', 'granted', 'granted_date', 'project')
list_display_links = ('realname', 'service_id') list_display_links = ('realname', 'service_id')
# action = ['export_as_csv'] # action = ['export_as_csv']
@ -49,7 +49,7 @@ class BusinessCardAdmin(admin.ModelAdmin):
@admin.register(Literature) @admin.register(Literature)
class LiteratureAdmin(admin.ModelAdmin): class LiteratureAdmin(admin.ModelAdmin):
save_as = True save_as = True
search_fields = (('realname', 'service_id'), 'granted', 'granted_date')
search_fields = ('realname', 'service_id', 'granted', 'granted_date')
list_display = ('realname', 'service_id', 'granted', 'granted_date') list_display = ('realname', 'service_id', 'granted', 'granted_date')
list_display_links = ('realname', 'service_id') list_display_links = ('realname', 'service_id')
date_hierarchy = 'granted_date' date_hierarchy = 'granted_date'
@ -73,7 +73,7 @@ class HonoraryCertificateAdmin(admin.ModelAdmin):
@admin.register(Library) @admin.register(Library)
class LibraryAdmin(admin.ModelAdmin): class LibraryAdmin(admin.ModelAdmin):
save_as = True save_as = True
search_fields = (('realname', 'service_id'), 'granted', 'granted_date')
search_fields = ('realname', 'service_id', 'granted', 'granted_date')
list_display = ('realname', 'service_id', 'granted', 'granted_date') list_display = ('realname', 'service_id', 'granted', 'granted_date')
list_display_links = ('realname', 'service_id') list_display_links = ('realname', 'service_id')
date_hierarchy = 'granted_date' date_hierarchy = 'granted_date'
@ -81,7 +81,7 @@ class LibraryAdmin(admin.ModelAdmin):
@admin.register(IFG) @admin.register(IFG)
class IFGAdmin(admin.ModelAdmin): class IFGAdmin(admin.ModelAdmin):
save_as = True save_as = True
search_fields = (('realname', 'service_id'), 'granted', 'granted_date')
search_fields = ('realname', 'service_id', 'granted', 'granted_date')
list_display = ('realname', 'service_id', 'granted', 'granted_date') list_display = ('realname', 'service_id', 'granted', 'granted_date')
list_display_links = ('realname', 'service_id') list_display_links = ('realname', 'service_id')
date_hierarchy = 'granted_date' date_hierarchy = 'granted_date'
@ -97,7 +97,7 @@ class TravelAdmin(admin.ModelAdmin):
@admin.register(Email) @admin.register(Email)
class EmailAdmin(admin.ModelAdmin): class EmailAdmin(admin.ModelAdmin):
save_as = True save_as = True
search_fields = (('realname', 'service_id'), 'granted', 'granted_date')
search_fields = ('realname', 'service_id', 'granted', 'granted_date')
list_display = ('realname', 'service_id', 'granted', 'granted_date') list_display = ('realname', 'service_id', 'granted', 'granted_date')
list_display_links = ('realname', 'service_id') list_display_links = ('realname', 'service_id')
date_hierarchy = 'granted_date' date_hierarchy = 'granted_date'
@ -106,7 +106,7 @@ class EmailAdmin(admin.ModelAdmin):
@admin.register(List) @admin.register(List)
class ListAdmin(admin.ModelAdmin): class ListAdmin(admin.ModelAdmin):
save_as = True save_as = True
search_fields = (('realname', 'service_id'), 'granted', 'granted_date')
search_fields = ('realname', 'service_id', 'granted', 'granted_date')
list_display = ('realname', 'service_id', 'granted', 'granted_date') list_display = ('realname', 'service_id', 'granted', 'granted_date')
list_display_links = ('realname', 'service_id') list_display_links = ('realname', 'service_id')
date_hierarchy = 'granted_date' date_hierarchy = 'granted_date'

+ 1
- 1
input/models.py View File

@ -124,7 +124,7 @@ class Project(Volunteer):
class Intern(Volunteer): class Intern(Volunteer):
'''abstrat base class for data entry from /intern (except Project)'''
'''abstract base class for data entry from /intern (except Project)'''
request_url = models.URLField(max_length=2000, verbose_name='Antrag (URL)') request_url = models.URLField(max_length=2000, verbose_name='Antrag (URL)')
intern_notes = models.TextField(max_length=1000, blank=True) intern_notes = models.TextField(max_length=1000, blank=True)
class Meta: class Meta:

Loading…
Cancel
Save