feature_phone.admin module¶
Define how Django should present feature phone-specific models to administrators.
-
class
feature_phone.admin.
InstructionsAdmin
(model, admin_site)¶ Bases:
feature_phone.admin.RecordingAdmin
Admin for feature phone instructions model, which includes questions.
-
actions
= ('download_files',)¶
-
display_key
(instructions)¶
-
display_text
(instructions)¶
-
empty_value_display
= '(Empty)'¶
-
list_display
= ('display_text', 'display_key', 'language', 'recording')¶
-
list_filter
= ('language',)¶
-
search_fields
= ('text', 'tag')¶
-
-
class
feature_phone.admin.
RecordingAdmin
(model, admin_site)¶ Bases:
pcari.admin.AdminViewMixin
Model admin that supports the storage of audio recordings.
-
add_to_zip
(zip_file, obj, fields)¶ Writes recording files of a model to zip folder sorted by subfolders named after each field of the object.
Parameters: - zip_file – a zipfile.ZipFile object where recordings will be written to.
- obj – an instance of a Response or Respondent object to save recordings from.
- fields – a list of strings where each element is a name of a field of obj.
-
download_files
(request, queryset)¶ Prepare a ZIP file of all file fields for selected instances.
Parameters: queryset – a Django QuerySet of models selected for this action.
-
formfield_overrides
= {<class 'django.db.models.fields.files.FileField'>: {'widget': <django.forms.widgets.FileInput object at 0x7f8564e18690>}}¶
-
get_file_fields
(model)¶ Return a model’s field names as a list of strings.
-
-
class
feature_phone.admin.
RespondentAdmin
(model, admin_site)¶ Bases:
feature_phone.admin.RecordingAdmin
Admin for feature phone respondent model.
-
actions
= ('download_files', 'classify_digits')¶
-
classify_digits
(request, queryset)¶ Admin action to call the ASR to transcribe the given responses
-
static
classify_responses
(language_code, asr_root)¶
-
empty_value_display
= '(Empty)'¶
-
list_display
= ('id', 'call_sid', 'age', 'gender', 'location', 'language')¶
-
list_filter
= ('language',)¶
-
-
class
feature_phone.admin.
ResponseAdmin
(model, admin_site)¶ Bases:
feature_phone.admin.RecordingAdmin
Admin for feature phone response model.
-
actions
= ('download_files',)¶
-
empty_value_display
= '(Empty)'¶
-
list_display
= ('__unicode__', 'timestamp', 'respondent', 'url')¶
-
list_filter
= ('timestamp',)¶
-