def get_create_option(self, context, q):
create_option = []<EOL>display_create_option = False<EOL>if self.create_field and q:<EOL><INDENT>page_obj = context.get('<STR_LIT>', None)<EOL>if page_obj is None or page_obj.number == <NUM_LIT:1>:<EOL><INDENT>display_create_option = True<EOL><DEDENT><DEDENT>if display_create_option and self.has_add_permission(self.request):<EOL><INDENT>'''<STR_LIT>'''<EOL>for s in Location.objects.filter(<EOL>Q(<EOL>Q(name__istartswith=q) & Q(transactionparty__isnull=True)<EOL>)<EOL>):<EOL><INDENT>create_option += [{<EOL>'<STR_LIT:id>': '<STR_LIT>' % s.id,<EOL>'<STR_LIT:text>': _('<STR_LIT>') % {'<STR_LIT:location>': s.name},<EOL>'<STR_LIT>': True,<EOL>}]<EOL><DEDENT>for s in StaffMember.objects.filter(<EOL>Q(<EOL>(Q(firstName__istartswith=q) | Q(lastName__istartswith=q)) &<EOL>Q(transactionparty__isnull=True)<EOL>)<EOL>):<EOL><INDENT>create_option += [{<EOL>'<STR_LIT:id>': '<STR_LIT>' % s.id,<EOL>'<STR_LIT:text>': _('<STR_LIT>') % {'<STR_LIT>': s.fullName},<EOL>'<STR_LIT>': True,<EOL>}]<EOL><DEDENT>for s in User.objects.filter(<EOL>Q(<EOL>(Q(first_name__istartswith=q) | Q(last_name__istartswith=q)) &<EOL>Q(staffmember__isnull=True) & Q(transactionparty__isnull=True)<EOL>)<EOL>):<EOL><INDENT>create_option += [{<EOL>'<STR_LIT:id>': '<STR_LIT>' % s.id,<EOL>'<STR_LIT:text>': _('<STR_LIT>') % {'<STR_LIT:user>': s.get_full_name()},<EOL>'<STR_LIT>': True,<EOL>}]<EOL><DEDENT>create_option += [{<EOL>'<STR_LIT:id>': q,<EOL>'<STR_LIT:text>': _('<STR_LIT>') % {'<STR_LIT>': q},<EOL>'<STR_LIT>': True,<EOL>}]<EOL><DEDENT>return create_option<EOL>
Form the correct create_option to append to results.