
from django.contrib import admin

from djurk.models import HIT

class HIT_Admin(admin.ModelAdmin):
    list_display = (
        'creation_time',
        'hit_id',
        'hit_type_id',
        'title',
        'reward'
    )
    list_filter = (
        'creation_time',
        'hit_status',
        'hit_review_status',
    )
    search_fields = (
        'hit_id',
        'hit_type_id',
        'title',
        'description',
        'keyword',
    )

admin.site.register(HIT, HIT_Admin)


from django.contrib import admin

from djurk.models import HIT

class HIT_Admin(admin.ModelAdmin):
    date_hierarchy = 'creation_time'
    fieldsets = (
            (None, {
                'fields': (('hit_id','hit_type_id'),
                           ('creation_time', 'hit_status'),
                           ('title', 'keywords', 'description'),
                           'reward',
                           'requester_annotation',
                           ),
            }),
            ('HIT Details', {
                'classes': ('collapse',),
                'fields': (
                     'lifetime_in_seconds',
                     'auto_approval_delay_in_seconds',
                     'number_of_similar_hits',
                     'hit_review_status',
                 )
            }),
            ('Assignment Overview', {
                'classes': ('collapse',),
                'fields': (
                     'max_assignments',
                     'assignment_duration_in_seconds',
                     'number_of_assignments_pending',
                     'number_of_assignments_available',
                     'number_of_assignments_completed',
                 )
            }),
    )
    list_display = (
        'creation_time',
        'hit_id',
        'hit_type_id',
        'title',
        'reward'
    )
    readonly_fields = (
        'creation_time',
        'hit_id',
        'hit_type_id',
        'hit_status',
        'hit_review_status',
    )
    list_display_links = list_display
    list_filter = (
        'hit_status',
        'hit_review_status',
        'creation_time',
    )
    read_only_fields = ('creation_time',)
    search_fields = (
        'hit_id',
        'hit_type_id',
        'title',
        'description',
        'keyword',
    )

admin.site.register(HIT, HIT_Admin)

Customize HIT Admin to "fit your brain"
Customize HIT Admin to "fit your brain"

  
  from django.contrib import admin
  
  from djurk.models import HIT
  
  class HIT_Admin(admin.ModelAdmin):
+     date_hierarchy = 'creation_time'
+     fieldsets = (
+             (None, {
+                 'fields': (('hit_id','hit_type_id'),
+                            ('creation_time', 'hit_status'),
+                            ('title', 'keywords', 'description'),
+                            'reward',
+                            'requester_annotation',
+                            ),
+             }),
+             ('HIT Details', {
+                 'classes': ('collapse',),
+                 'fields': (
+                      'lifetime_in_seconds',
+                      'auto_approval_delay_in_seconds',
+                      'number_of_similar_hits',
+                      'hit_review_status',
+                  )
+             }),
+             ('Assignment Overview', {
+                 'classes': ('collapse',),
+                 'fields': (
+                      'max_assignments',
+                      'assignment_duration_in_seconds',
+                      'number_of_assignments_pending',
+                      'number_of_assignments_available',
+                      'number_of_assignments_completed',
+                  )
+             }),
+     )
      list_display = (
          'creation_time',
          'hit_id',
          'hit_type_id',
          'title',
          'reward'
      )
-     list_filter = (
+     readonly_fields = (
          'creation_time',
+         'hit_id',
+         'hit_type_id',
          'hit_status',
          'hit_review_status',
      )
+     list_display_links = list_display
+     list_filter = (
+         'hit_status',
+         'hit_review_status',
+         'creation_time',
+     )
+     read_only_fields = ('creation_time',)
      search_fields = (
          'hit_id',
          'hit_type_id',
          'title',
          'description',
          'keyword',
      )
  
  admin.site.register(HIT, HIT_Admin)
  
Customize HIT Admin to "fit your brain"
## Code Before:

from django.contrib import admin

from djurk.models import HIT

class HIT_Admin(admin.ModelAdmin):
    list_display = (
        'creation_time',
        'hit_id',
        'hit_type_id',
        'title',
        'reward'
    )
    list_filter = (
        'creation_time',
        'hit_status',
        'hit_review_status',
    )
    search_fields = (
        'hit_id',
        'hit_type_id',
        'title',
        'description',
        'keyword',
    )

admin.site.register(HIT, HIT_Admin)

## Instruction:
Customize HIT Admin to "fit your brain"
## Code After:

from django.contrib import admin

from djurk.models import HIT

class HIT_Admin(admin.ModelAdmin):
    date_hierarchy = 'creation_time'
    fieldsets = (
            (None, {
                'fields': (('hit_id','hit_type_id'),
                           ('creation_time', 'hit_status'),
                           ('title', 'keywords', 'description'),
                           'reward',
                           'requester_annotation',
                           ),
            }),
            ('HIT Details', {
                'classes': ('collapse',),
                'fields': (
                     'lifetime_in_seconds',
                     'auto_approval_delay_in_seconds',
                     'number_of_similar_hits',
                     'hit_review_status',
                 )
            }),
            ('Assignment Overview', {
                'classes': ('collapse',),
                'fields': (
                     'max_assignments',
                     'assignment_duration_in_seconds',
                     'number_of_assignments_pending',
                     'number_of_assignments_available',
                     'number_of_assignments_completed',
                 )
            }),
    )
    list_display = (
        'creation_time',
        'hit_id',
        'hit_type_id',
        'title',
        'reward'
    )
    readonly_fields = (
        'creation_time',
        'hit_id',
        'hit_type_id',
        'hit_status',
        'hit_review_status',
    )
    list_display_links = list_display
    list_filter = (
        'hit_status',
        'hit_review_status',
        'creation_time',
    )
    read_only_fields = ('creation_time',)
    search_fields = (
        'hit_id',
        'hit_type_id',
        'title',
        'description',
        'keyword',
    )

admin.site.register(HIT, HIT_Admin)
