from django.contrib import admin
from django.contrib.sessions.models import Session

# Register your models here.

from .models import Patient, Doctor, Question, Answer, Record, Symptom, Notes, Entity, Log

class PatientAdmin(admin.ModelAdmin):
	list_display = [field.name for field in Patient._meta.get_fields()]

class LogAdmin(admin.ModelAdmin):
	list_display = [field.name for field in Log._meta.get_fields()]

class DoctorAdmin(admin.ModelAdmin):
	list_display = [field.name for field in Doctor._meta.get_fields()]

class AnswerAdmin(admin.ModelAdmin):
	list_display = [field.name for field in Answer._meta.get_fields()]

class QuestionAdmin(admin.ModelAdmin):
	list_display = ('question',)

class EntityAdmin(admin.ModelAdmin):
	list_display = ('name', 'street', 'city', 'state', 'country',)
	# list_display = [field.name for field in Entity._meta.get_fields()]

class RecordAdmin(admin.ModelAdmin):
	# list_display = [field.name for field in Record._meta.get_fields()]
	list_display = ('date', 'user', 'score', 'created_date', 'signed',)

class NotesAdmin(admin.ModelAdmin):
	list_display = [field.name for field in Notes._meta.get_fields()]

class SymptomAdmin(admin.ModelAdmin):
	list_display = [field.name for field in Symptom._meta.get_fields()]

class SessionAdmin(admin.ModelAdmin):
    def _session_data(self, obj):
        return obj.get_decoded()
    list_display = ['session_key', '_session_data', 'expire_date']


admin.site.register(Session, SessionAdmin)
admin.site.register(Log, LogAdmin)
admin.site.register(Patient, PatientAdmin)
admin.site.register(Doctor, DoctorAdmin)
admin.site.register(Answer, AnswerAdmin)
admin.site.register(Question, QuestionAdmin)
admin.site.register(Entity, EntityAdmin)
admin.site.register(Record, RecordAdmin)
admin.site.register(Notes, NotesAdmin)
admin.site.register(Symptom, SymptomAdmin)
@@ -230,32 +230,92 @@
 in.ModelAdmin):%0A
+%09print %5Bfield.name for field in Patient._meta.get_fields()%5D%0A
 %09list_display = 
@@ -357,32 +357,58 @@
 eta.get_fields()
+ if field.name != 'doctor'
 %5D%0A%0Aclass LogAdmi
@@ -589,32 +589,59 @@
 eta.get_fields()
+ if field.name != 'patient'
 %5D%0A%0Aclass AnswerA

remove doctor field from patient and patient from doctor field so it renders properly if fields are empty