def get_fields(self, request, obj=None): fields = super(WorkflowMemoAdmin, self).get_fields(request, obj) not_resolved = getattr(obj, 'status', '') != WorkflowMemo.Status.RESOLVED if is_customer(request.user, obj) and not_resolved: fields.pop(fields.index('complete')) if not obj: fields.pop(fields.index('created')) return fields
def get_readonly_fields(self, request, obj=None): if is_customer(request.user, obj): return self.readonly_fields + ['spent'] return self.readonly_fields + ['user', 'role']
def get_readonly_fields(self, request, obj=None): if is_customer(request.user, obj): return self.readonly_fields return self.readonly_fields + self.participant_readonly_fields