Admin-Optionen
This commit is contained in:
@@ -40,4 +40,4 @@ Statt `python3 manage.py` müsste auch der direkte Aufruf des Skripts funktionie
|
||||
## Im- und Export
|
||||
|
||||
- YAML exportieren: `./manage.py dumpdata --format yaml --indent 2 -o ../fixtures/fixture.yaml`
|
||||
- `authors.yaml` importieren: `./manage.py import_authors <Pfad>`
|
||||
- `authors.yml` importieren: `./manage.py import_authors <Pfad>`
|
||||
|
||||
@@ -6,6 +6,9 @@ from django.contrib.contenttypes.admin import GenericTabularInline, GenericStack
|
||||
# TODO: Links zu Suchseiten mit Vorbelegungen
|
||||
|
||||
|
||||
## Inlines
|
||||
|
||||
|
||||
class IdentityInline(admin.TabularInline):
|
||||
model = Identity
|
||||
ordering_field = ['alias',]
|
||||
@@ -42,10 +45,14 @@ class MediumInline(admin.TabularInline):
|
||||
#show_change_link = True
|
||||
|
||||
|
||||
## ModelAdmins
|
||||
|
||||
|
||||
@admin.register(Person)
|
||||
class PersonAdmin(admin.ModelAdmin):
|
||||
list_display = Person.list_display
|
||||
search_fields = ('name', 'full_name', 'name_native', 'birth_name')
|
||||
list_editable = ('details_secret',)
|
||||
inlines = [
|
||||
IdentityInline,
|
||||
AuthorIDInline,
|
||||
@@ -58,7 +65,7 @@ class PersonAdmin(admin.ModelAdmin):
|
||||
class IdentityAdmin(admin.ModelAdmin):
|
||||
list_display = Identity.list_display
|
||||
search_fields = ('alias', 'organization')
|
||||
list_filter = ['person', 'organization', TaggitListFilter]
|
||||
list_filter = ['organization', TaggitListFilter]
|
||||
exclude = ('tags',)
|
||||
inlines = [
|
||||
TaggitTabularInline,
|
||||
@@ -68,12 +75,15 @@ class IdentityAdmin(admin.ModelAdmin):
|
||||
@admin.register(AuthorID)
|
||||
class AuthorIDAdmin(admin.ModelAdmin):
|
||||
list_display = AuthorID.list_display
|
||||
list_editable = ('key','value',)
|
||||
list_filter = ('key',)
|
||||
search_fields = ('value',)
|
||||
|
||||
|
||||
@admin.register(AuthorURL)
|
||||
class AuthorURLAdmin(admin.ModelAdmin):
|
||||
list_display = AuthorURL.list_display
|
||||
list_editable = ('name','url',)
|
||||
search_fields = ('url',)
|
||||
|
||||
|
||||
@@ -81,6 +91,7 @@ class AuthorURLAdmin(admin.ModelAdmin):
|
||||
class ContactAdmin(admin.ModelAdmin):
|
||||
date_hierarchy = 'last_try'
|
||||
list_display = Contact.list_display
|
||||
list_editable = ('last_try','user','success',)
|
||||
search_fields = ('name', 'address', 'remarks')
|
||||
#prepopulated_fields = {'user': ('',)}
|
||||
inlines = [
|
||||
@@ -91,4 +102,6 @@ class ContactAdmin(admin.ModelAdmin):
|
||||
@admin.register(Medium)
|
||||
class MediumAdmin(admin.ModelAdmin):
|
||||
list_display = Medium.list_display
|
||||
list_editable = ('key','value',)
|
||||
list_filter = ('key',)
|
||||
search_fields = ('value',)
|
||||
|
||||
@@ -53,7 +53,7 @@ class Person(models.Model):
|
||||
verbose_name_plural = 'Personen'
|
||||
ordering = ['name','birth_year']
|
||||
|
||||
list_display = ['name', 'full_name', 'birth_year']
|
||||
list_display = ['name', 'full_name', 'details_secret', 'birth_year']
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
@@ -211,6 +211,9 @@ class Contact(models.Model):
|
||||
models.Index(fields=["content_type", "object_id"]),
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
return str(self.content_object)
|
||||
|
||||
list_display = ['content_object', 'name', 'last_try', 'user', 'success']
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user