예제 #1
0
class SocioDemoObservationAdmin(admin.ModelAdmin):
    actions = [
        stream_as_csv_action("CSV Export (stream)",
                             fields=[
                                 'phenomenon_time_from',
                                 'phenomenon_time_duration',
                                 'observed_property',
                                 'feature_of_interest',
                                 'procedure',
                                 'age_for_human',
                                 'gender',
                                 'occurrence_type',
                                 'result_for_human',
                             ]),
    ]

    list_display = ('phenomenon_time_from', 'time_slots', 'observed_property',
                    'feature_of_interest', 'procedure', 'age_for_human',
                    'gender', 'occurrence_type', 'result_for_human')
    list_filter = (DateRangeRangeFilter, ('time_slots',
                                          admin.RelatedOnlyFieldListFilter),
                   ('observed_property', admin.RelatedOnlyFieldListFilter),
                   ('feature_of_interest', admin.RelatedOnlyFieldListFilter),
                   ('procedure', admin.RelatedOnlyFieldListFilter),
                   AgeRangeFilter, 'gender', 'occurrence_type',
                   ('result_null_reason', ResultNullReasonFilter))
    fields = list_display + ('phenomenon_time_duration_for_human',
                             'created_at', 'updated_at')
    readonly_fields = fields
예제 #2
0
class ObservationAdmin(admin.ModelAdmin):
    actions = [
        stream_as_csv_action("CSV Export (stream)",
                             fields=[
                                 'phenomenon_time_from',
                                 'phenomenon_time_duration',
                                 'observed_property',
                                 'feature_of_interest',
                                 'procedure',
                                 'result_for_human',
                             ]),
    ]

    list_display = (
        'phenomenon_time_from',
        'phenomenon_time_duration_for_human',
        'observed_property',
        'feature_of_interest',
        'procedure',
        'result_for_human',
    )
    list_filter = (
        DateRangeRangeFilter,
        ('observed_property', admin.RelatedOnlyFieldListFilter),
        ('feature_of_interest', admin.RelatedOnlyFieldListFilter),
        ('procedure', admin.RelatedOnlyFieldListFilter),
        ('result_null_reason', ResultNullReasonFilter),
    )
    fields = list_display
    readonly_fields = fields